Commit graph

257 commits

Author SHA1 Message Date
Seonghyun Kim
fe0c65118c * When evaluate super.foo = 1 we should throw TypeError.
when PutValue is failed + isStrict('use strict` or class method).

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-05-27 17:09:09 +09:00
Seonghyun Kim
c9e4d5c6fd Implement more things about module
* Implement export * as {name} from {src} feature
* Update Script::resolveExport for following new spec
* Update test262 driver for running test cases correctly
* Implement changes of ModuleNamespaceObject::[[*]]

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-05-26 12:54:45 +09:00
Seonghyun Kim
ee97ae6412 Fix module bugs
* Export default function declaration should treat as function declaration
* But there is no name on export function decl, we should the statement as function expression
* Check duplicate export name correctly
* Don't include FIXTURE files as testset in test262

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-05-26 12:54:45 +09:00
Seonghyun Kim
323c2dca20 Each function parameter should have own declarative environment.
but I don't want to add extra bytecodes for this.
and It is only needed when there is direct eval operation.
so I wrap each parameter block with small arrow function.

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-05-18 15:18:10 +09:00
Seonghyun Kim
355d7244f1 Fix minor issues
* When there is arrow function on class ctor, we should use heap-allocated lex env for class ctor.
  because we need to compute this variable on run-time
* when there is super expression with computed case, we should load this binding first for testing binding

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-05-18 15:18:10 +09:00
HyukWoo Park
3520529a50 Fix minor defects
* remove obsolete return statements
* add guard code in parseClassElement

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-05-08 16:09:45 +09:00
Achie
928181bc4f Fix Strict-NonSimple parameter rules within functions
Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2020-05-07 10:11:56 +09:00
Zoltan Herczeg
064d1d09b8 Fix debugger support for arrow functions and var/let/const statements.
Declarations with assignment should insert breakpoints, while
declarations without assignment should not.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-01 15:14:33 +09:00
Zoltan Herczeg
d2cc5fec47 Support evaluating expression in the debugger.
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-03-23 12:16:50 +09:00
Seonghyun Kim
5a284d486b Implement additional ECMAScript Features for Web Browsers
* Implement VariableStatement in catch rules
* Implement Function Declation rules

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-03-19 15:01:26 +09:00
Seonghyun Kim
4670a4097f Implement additional ECMAScript Features for Web Browsers
* Implement rules of Global Function declaration

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-03-18 16:57:42 +09:00
Seonghyun Kim
cf2c21e023 Implement additional ECMAScript Features for Web Browsers
* caller extension of ArgumentsObject is removed from recent ECMAScript standard
* __proto__ on object expression is changed.

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-03-18 16:57:42 +09:00
Seonghyun Kim
1a1078a462 Should treat state of async, * correctly for class method, object method
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-03-12 13:31:43 +09:00
Seonghyun Kim
ae4b3ee589 Fix bugs
* Treat single `let` as Identifier in parsing ExpressionStatement
* The `let` contextual keyword must not contain Unicode escape sequences.
* U+180E had been changed to `Other, Format [Cf]` from `Separator, Space [Zs]`
  see https://github.com/tc39/ecma262/pull/300, https://github.com/Microsoft/ChakraCore/issues/2120
* The `let` contextual keyword must not contain Unicode escape sequences
* We need to allocate new env on right side of for in-of head when there is lexical decl on left side

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-03-12 13:31:43 +09:00
Bela Toth
e53850470d Implement optional catch binding
Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2020-03-12 11:14:52 +09:00
MuHong Byun
e2f1c3f47d Fix LGPL License verison typo (2.0 -> 2.1)
Signed-off-by: MuHong Byun <mh.byun@samsung.com>
2020-03-10 11:35:20 +09:00
Seonghyun Kim
91b8b016b3 Implement for-await-of statement
* Implement basic behavior of for-await-of statement
* for statement should allow `for (..) let {}` form
* Fix bug in yield*
* AsyncFromSyncIteratorContinuation is changed on newer drafted spec(11.0). I apply the change.

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-03-06 14:48:58 +09:00
Zoltan Herczeg
a555ac52f6 Initial implementation of the Escargot Debugger. 2020-03-05 10:36:55 +09:00
Seonghyun Kim
ed921de4a4 We should make lexical block for function decl in if-statement without brace
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-03-03 18:41:19 +09:00
Seonghyun Kim
8c776cfe10 Fix generator bugs
* Generator is also executed until parameter initialize block when generator function is called
* Generator method in object should indicate correct place to start

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-03-02 13:47:22 +09:00
Seonghyun Kim
ad6a0e9114 Allow async generator for object init, class
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-02-14 16:37:45 +09:00
HyukWoo Park
b37be56054 Add implicit name to getter, setter function definition
* apparent Identifier name is directly added to getter, setter function
* remove one LoadLiteral bytecode for each name of getter, setter function

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-02-05 16:17:00 +09:00
HyukWoo Park
86a125ef36 Add function and class name in object expression
* add symbol name for property method if it is not an empty symbol
* MetaNode in parseLabelledStatement is fixed correctly

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-02-05 16:17:00 +09:00
HyukWoo Park
3c6032f8c9 Fix bugs in function parameter
* fix function length to represent the number of consecutive identifiers from the start of parameter list
* collect parameter names including the target names of patterns and rest element
* separate function length and parameter count
* simplify the process of parameter collecting and rename parameter related functions more intuitively

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-02-03 13:49:44 +09:00
HyukWoo Park
a36bd117d3 Fix minor bugs in parsing
* fix the order of BindingRestElement bytecode generation
* add implicit name for lexical binding
* reset firstCoverInitializedNameError for for statement header

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-02-03 13:49:30 +09:00
Seonghyun Kim
f61ef74973 Implement basic of AsyncGeneratorFunction
* Add ScriptAsyncGeneratorFunctionObject, AsyncGeneatorObject
  * Implement basic behavior of AsyncGeneratorFunction

Update Script Parser
  * Reverse allowYield value.
  * Allow AsyncGenerator
  * In parameter, we should not allow yield, await expression

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-02-03 11:50:26 +09:00
HyukWoo Park
f2439c2a41 Fix bugs in destruction operation
* fix to compare string/symbol correctly in marking enumerated key
* fix iterator close operation to call 'return' function of iterator and then throw exception
* add implicit name in object property parsing
* resolve each target of pattern first, and then store the value into it

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-01-23 14:36:18 +09:00
Seonghyun Kim
ae35a576f5 Implement more things according to newer ECMAScript spec
* Fix parser error related with async arrow function
* CodeBlock may have diffrent source code start position data(from `function` keyword)
  - new ECMAScript spec says we should make function source string from `function` keyword
* Apply new spec on builtin Function constructor
* AsyncFunctions must have correct initial properties

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-01-22 18:01:52 +09:00
HyukWoo Park
f232bba7d7 Add class implicit name in array/object pattern
* 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>
2020-01-21 11:03:05 +09:00
Seonghyun Kim
5e7f0da0ee Fix various bugs
* 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>
2020-01-17 17:18:30 +09:00
Seonghyun Kim
caa0fbc3fe Implement compress CompressibleStrings on GC reclaim end event
* 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>
2020-01-10 17:37:00 +09:00
HyukWoo Park
47bf20782e Check strict mode immediately
* 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>
2020-01-10 11:17:19 +09:00
seonghyun kim
98d4ef6942 Reduce memory usage
* 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>
2019-12-24 14:38:09 +09:00
HyukWoo Park
7c13a84057 Fix valueStringLiteral method in ScannerResult
* remove unnecessary StringView allocation
* simplify parseObjectPropertyKey mothod

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-12-18 13:38:41 +09:00
seonghyun kim
fba9396ec9 Reduce memory usage
* 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>
2019-12-18 11:11:26 +09:00
HyukWoo Park
963cc4aa07 Handle destructuring in try-catch clause
* 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>
2019-12-17 09:37:43 +09:00
seonghyun kim
a126f3dd13 Treat function parameter initialization area as first lexical block
* in parameter initialization area, we cannot access var declared variables

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-12-10 15:43:52 +09:00
seonghyun kim
5dfcfd15bd Fix bugs related with switch statement
* 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>
2019-12-09 09:55:36 +09:00
seonghyun kim
53906a6d81 Optimize runtime performance
* 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>
2019-12-05 15:04:20 +09:00
HyukWoo Park
b852fa1079 Fix a bug : ignore null or undefined value for spread element in object destructing
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-12-03 19:22:14 +09:00
HyukWoo Park
c328e53927 Implement exponential operation
* 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>
2019-11-27 09:38:22 +09:00
HyukWoo Park
d918e65ff9 Fix some parsing bugs
* 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>
2019-11-25 10:35:07 +09:00
HyukWoo Park
5b522fbc2d Fix a bug when shorthand object property is used in object destruction
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-11-18 16:05:59 +09:00
HyukWoo Park
01de1210b9 Update rest element in Object pattern
* BindingRestElement bytecode handles Iterator and EnumerateObject both
* MarkEnumerateKey bytecode is added to mark visited properties

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-11-18 15:56:15 +09:00
HyukWoo Park
b0a31717c5 Update spread element in Object initialization
* 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>
2019-11-18 15:56:15 +09:00
HyukWoo Park
e2e34d07db Handle assignment pattern in Object pattern
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-11-18 15:56:15 +09:00
seonghyun kim
42231eba48 Implement basic behavior of async, await.
* Add ExecutionPauser for yield, await
* Add new public API

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-11-15 16:07:03 +09:00
HyukWoo Park
863c99c73f Minor bug fix about duplicated finishIdentifier call in parser
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-11-07 14:38:04 +09:00
HyukWoo Park
05678d6449 Update parsing of async feature
* 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>
2019-11-06 18:16:31 +09:00
HyukWoo Park
877539c538 Replace NodeVector by LinkedList
* 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>
2019-11-05 13:04:13 +09:00