* assignment in array/object pattern has conditional implicit names of class expression
* ClassExpression which also has 'name' static member should not have a implicit name
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Create new promiseCapability when async function called
* __{define,lookup}{Getter,Setter} should follow spec
* builtin String html functions should have correct name
* Fix parser bugs
- allow `{ let e; { function e(){} } }` case in parser
- disallow `try {} catch(e) { function e() {} }` case in parser
- recover await state correctly
* Date.prototype.setYear should use toInteger for input
* update tools/test/test262/make_excludelist.py and its resource
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* Compress CompressibleStrings on GC reclaim end event
- if there is reference about data of CompressibleString on stack, we should give up compressing.
we don't need to search heap space because I redesigned StringView
(we should not store string buffer data on heap without owner)
* Redesign StringView
- Don't save string buffer address as its member. because buffer of CompressibleString can be deleted
- If we don't save string buffer address on StringView, parser performance may dropped.
becuase parser access string data a lot.
so I introduce ParserStringView. it saves buffer address. we should ParserStringView on parser only.
we can save string buffer address while parsing. because GC is disabled while parsing.
* Enable CompressibleString always
* Implement cache of RegExpOptionStrings
* Implement finding system locale function on RuntimeICUBinder avoiding call uloc_getDefault.
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* check and convert to strict mode ahead of following tokens
* identifier which has a valid keyword in strict mode is also converted to the complete keyword
* fixes#513
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Store array length property in its member variable not value vector
- This can reduce one of GC_MALLOC call if there is not value in ArrayObject other than fastmode value
* Prevent memory leak from VMInstance, Context
* Change vector capacity reserve strategy
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* Reduce size of RopeString
* Use fit memory if possible for ArrayObject fastModeData
* Re-implement ByteCode pruning logic
* Re-implement inline-cache for reducing memory usage
* Remove std::vector with gc_allocator. it can cause memory leak
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* fix bugs about object, array destructuring in catch clause
* directly generate bytecode about lexical variable initialization instead of allocating a temporal AssignmentExpressionNode
* RegisterReferenceNode removed because this node is used only during the bytecode generation process
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Treat let, const variables in switch statement correctly.
* When Evaluate switch case block, We should set script execution result as undefined.
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* Optimize ObjectStructurePropertyDescriptor
* Don't initialize inline storage of VectorWithInlineStorage
* Add Object::setPrototypeForIntrinsicObjectCreation for fast initialize
* Add ArrayObject::ArrayObject(ExecutionState& state, const uint64_t& size) for fast initialize
* Store stack-limit instead of stack-base
* Reduce size of ExecutionState
* Add fast version of Object::ownPropertyKeys for optimize Object.keys
* Add ValueVectorWithInlineStorage
* Remove some compiler warnings
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* update exponential operation and exponentiation-equal assignment
* unnecessary header files are removed in some Node files
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* handle implicit function name in parameter list
* handle trailing-comma and also support the trailing-comma rule in setter function
* fix function length not to count parameter-forms other than simple identifier
* disable one wrong TC in v8 (trailing-comma)
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* BindingRestElement bytecode handles Iterator and EnumerateObject both
* MarkEnumerateKey bytecode is added to mark visited properties
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* EnumerateObject is reworked and two derived classes are newly added
* Object spread element is handled through EnumerateObjectWithDestruction
* for-in operation is handled through EnumerateObjectWithIteration
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* add empty async related Nodes
* await and async are handled as a normal identifier
* add const keyword for passed NodeList reference in Node constructor
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* replace NodeVector by NodeList to completely separate the parsing memory from the GC heap
* each node of NodeList is allocated in AST pool
* NodeList passed as lvalue reference
* remove redundant constructor of each Node
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Initialize function name binding in interpreter
* If there are so many var variables on function, we should make hash map for finding var fast
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* fix a case that arrow function is located at the first of script
* fix a case that toStringWithoutException is called with no SandBox
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Fixup canDeclareName in ASTContext
* Add more callstack information on API
* Add onDelete callback on VMInstance
* Add BloomFilter as util
* Use BloomFilter in ASTFunctionContext for find out variable name existence
* Optimize parser using InlineStorageVector
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* parsing of function including parameter list and function body is skipped in scanner mode
* m_bodySrc in InterpretedCodeBlock is removed because it is no longer necessary
* some operator overloading in FreeableNode and DestructibleNode is fixed
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Revise AST Node allocation through ASTPool
* ASTAllocator is newly added for allocation of AST Nodes
* AST Node is allocated in pool memory and flushed once after bytecode is generated
* All reference counting overhead related to AST Node is removed
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Reduce memory operations in Parsing
* empty vector called SyntaxNodeVector is added for SyntaxChecker
* ASTFunctionScopeContext and ASTBlockScopeContext are allocated in ast pool instead of GC heap
* memory leak(ShellPlatform) in shell is fixed
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* When evaluate for-in, we should call [[Enumerate]] function & we shouldn't literate symbols and non-enumerable names.
* In esprima, we need to reset lastUsingName on {open, close}Block
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* Build numeral literal number in token only if needs
* Build string literal for ast only if needs
* Move NumeralData from ASTContext to ASTNode
* Fix compile error on gcc 7+
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* small-sized SmallScannerResult replaces origin ScannerResult in parsing process to reduce the memory pressure.
* ScannerResultVector in parseBinaryExpression is replaced by GC-independent SmallScannerResultVector to reduce the memory overhead (both the performance and memory usage)
* ParseFormalParametersResult holds SyntaxNodeVector instead of NodeVector because each parameter Node is re-generated when it is really necessary (parsing of function call) and we only needs the name and type of each parameter during the pre-parsing
* parser/scanner of parameter parsing is added
* clear up some unnecessary codes such as each friend class annotation in Nodes and NodeVectors
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Store child {ASTFunctionContext, InterpretedCodeBlock} as linked-list
* Reduce size of ScannerResult
* Remove Parser::scopeContexts
* Fix compile error in old system
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* Don't allocate new StringView on parser if possible
* Store esprima::Context::firstCoverInitializedNameError as pointer. it can reduce copy cost on esprima::*CoverGrammar
* Make Script as reexcutable if possible
* Don't save parsed source codes
- Remove SourceStringView
- When create AtomicString from StringView, we should make new string data instead of reference StringView
* Reduce size of StringBufferAccessData
* Fix crash in toString of FunctionObject.
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* all parser and scanner methods share common parsing codes, but part of creating a new Node is implemented by two ASTBuilders which are passed as argument
* SyntaxChecker only checks any syntax error
* NodeGenerator checks any syntax error and also creates a new Node
* remove unused Node methods and fix some typo in Node
* esprima::Messages is divided into another header file
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Rename ESCARGOT_OUTPUT=bin into shell and make shell_test for testing.
* Remove ESCARGOT_SHELL, -SCARGOT_STANDALONE and Rename ESCARGOT_ENABLE_VENDORTEST into ESCARGOT_ENABLE_TEST.
* Fix bug in PersistentRefHolder
* Add DebuggerStatementNode for preventing parsing error even if we cannot support
* Revise Platform layer for supporting es6 module
* Implmenent class constructor toString
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* we should replace block context before executing update expression in for statement
* merge ObjectDefineGetter, ObjectDefineSetter byte code into one code
* add some missed scan operation in parser
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* add invalid hexadecimal escape sequence error
* lexical declaration cannot appear in a single-statement context
* ASTContext structures are divided into another file
* pass more test262 TCs
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Reimplement finally block in try-statement.
* Replace `ReturnFunction`, `ReturnFunctionWithValue` bytecode with `End`.
* When for-of loop is exited by exception or break, we need to close iterator
* Don't add Return Statement in ByteCodeGenerator. We should add Return Statement in ScriptParser.
* Fix bug in yield expression.
* Implement add implicit class name on class expression.
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* parseFunction is divided into FunctionDeclaration and FunctionExpression to handle the function name differently
* let, yield keywords are enabled in some cases according to the standard
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Process 0x2028, 0x2029 char on template literal correctly
* Object are created by TaggedTemplateLiteral are should frozen
* When eval `super.foo = 1`, use `this` as receiver
* Implement Function.protoype.caller
* Fix processing '\0' char bug in builtinFileReadHelper
* When eval `yield delegate` repect it's result.
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* in ES6, we need to set function name when object literal has function expression on right side
* in ES6, we should not check duplicated property name on object literal
* Refactor Object::hasInstance & Object::getMethod
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* add syntax check for single parameter in arrow function
* use of parsePropertyMethod is fixed upto the latest esprima version
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* implement reinterpretExpressionAsPattern parsing method for conversion between ExpressionNode and PatternNode
* remove redundant modules in Patterns
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>