Commit graph

174 commits

Author SHA1 Message Date
Hyukwoo Park
c829029eae Fix a bug of variable declarations within patterns (#408)
* declarations of block scoped variables are correctly handled
* const variable check is added to GlobalEnvironmentRecord::setMutableBindingByBindingSlot

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-09-03 17:14:20 +09:00
Hyukwoo Park
46c6ffa8a2 Fix Patterns (#400)
* simplify bytecode generation of ArrayPatternNode and ObjectPatternNode by implementing generateStoreByteCode method
* fix bugs related to variable declarations by patterns
* remove unnecessary members in pattern

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-09-02 16:05:01 +09:00
Patrick Kim
b33e7df9a2 Implement MetaProperty(new.target) (#397)
* add some missed public api functions

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-29 20:26:20 +09:00
Patrick Kim
881a44e0fb Fixup generator (#393)
* We can use try-catch with yield together now.
* Implement return, throw function in GeneratorObject correctly
* yield expression parsing in esprima 3.1.1 is wrong. so I get right version of yield parsing from newer version of esprima

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-28 13:57:32 +09:00
Hyukwoo Park
cc3f7deb8c Remove redundant parameter modules (#390)
* CodeBlock has essential parameter name list only
* toString builtin function is fixed to use the entire source instead of body source
* some TCs are fixed upto the spec

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-08-27 10:40:30 +09:00
Hyukwoo Park
4a61f0f9b7 Implement lazy parameter initialization (#388)
* each parameter is initialized by bytecode execution
* patterns in parameter list are no longer allocated in the heap in default

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-08-23 19:21:14 +09:00
Patrick Kim
66bd235740 Remove c++ try-catch statement in interpreter function. (#387)
* separate ByteCodeGenerator::m_tryStatementCount into multiple items for implementing es6 generator

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-23 16:55:34 +09:00
Boram Bae
90240a18f8 Set the function name Implicitly (#386)
* Pass more test262 tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-08-23 16:55:10 +09:00
Patrick Kim
e3a8fba176 Migrate to new bdwgc 8.0 GCutil & use cmake on building gc (#385)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-21 18:14:36 +09:00
Hyukwoo Park
c51ba1bf0e Fix several modules in parser (#384)
* check duplicated parameter names at once
* temporal nodes are allocated on stack
* remove unnecessary structs and flags
* sync parsing part of default parameter to that of esprima code

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-08-21 15:16:05 +09:00
Patrick Kim
3c0a1cfddd Don't use heap allocated lexical environment if possible (#378)
- We should not heap allocated env on...
  * functions uses variable on upper function
  * functions have `typeof` operation
  * functions have unmapped arguments object
- Improve calling function performance by remove accessing vtable once in interpreter(from isCallable, call to just call)

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-20 10:41:06 +09:00
Zoltan Herczeg
9ff6ee34c5 Don't add empty function expression names to scopes. (#373)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-08-19 11:20:20 +09:00
Patrick Kim
8855166418 Enhance develoment productivity (#366)
* Add ESCARGOT_ASAN options for debug
* Throw statement should have correct line:column number
* Fix bug in sunspider-js in test driver. if we want to run sunspider test cases at once, excution order is important because some test ruins GlobalObject

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-14 11:10:21 +09:00
Hyukwoo Park
c28a8f6858 Skip the parsing of arrow function body in scan mode (#362)
* arrow function body is skipped in scan mode to match parseSingleFunctionChildIndex consistently with normal function body block
* extract parameter names right after pushing a scope context

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-08-13 17:00:38 +09:00
Hyukwoo Park
1d143c3871 Expand the parsing scope of function to include parameters (#360)
* we should parse the parameter list together for each function calls to treat argument initializers such as rest, default parameters
* for each function calls, we first parse the parameter list and then, parse the function body sequentially
* also remove and clearup some unnecessary parsing modules

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-08-12 14:02:27 +08:00
Robert Fancsik
2113ddd673 Fix arrow function bugs related to lazy instantiation (#353)
Fixed a bug when an arrow function with block braces is inside an arrow function without braces handled incorrently during an outer function lazy instantiation.
The inner arrow function treated the most outer simple function as its parent instead of the outer arrow function due to the invalid use of config.parseSingleFunction.
Also the 0 parseFunctionIndex must be valid for arrow functions as well during the lazy instantiation.

This patch fixes #343.

Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-08-08 09:53:39 +09:00
Boram Bae
de65761ac7 Implement GeneratorFunction constructor (#350)
* Fix some bugs
* Pass more test262 tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-08-06 22:12:49 +09:00
Hyukwoo Park
49266b6c9f Create rest parameter through bytecode interpretation (#348)
* CreateRestElement bytecode is newly added for generating a rest parameter
* RestElementNode is added to handle patterns in rest parameter later
* rest parameter is created at the first part of the function body execution

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-08-06 13:38:25 +09:00
Patrick Kim
43f442c560 Revise function call processes (#347)
* Revise [[call]], [[construct]] as described in spec
* Remove m_homeObject in FunctionObject.
* Implement ScriptClass{Constructor, Method}FunctionObject
    this subclass is used for saving [[homeObject]] and implement [[call]], [[consturct]]
* Add more(NewTargetBinder, ReturnValueBinder) into FunctionObjectProcessCallGenerator
* Remove feCounter in ByteCodeGenerationProcess. in ES6, function expression order & evaluation order can differ
* Add CallSuper ByteCode for interpret `super()` in class constructor
* Remove isOngoingSuperCall in ExecutionState
* Remove BuiltinFunctionObject. that was unnecessary

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-06 09:58:06 +09:00
Zoltan Herczeg
8708e4202c Only loops with label can be target of continue statement with label. (#345)
Note: a loop can have multiple labels.

Fixes #330.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-08-02 14:45:55 +09:00
Patrick Kim
356a103466 Separate FunctionObject (#344)
There are so many features in FunctionObject. so I separate FunctionObject into multiple classes.
  * Implement FunctionObjectProcessCallGenerator class for generate processCall code for each derived FunctionObject and implement [[call]], [[construct]] separately
  * Implement NativeFunctionObject, BuiltinFunctionObject for process NativeCall separately
  * Implement ScriptArrowFunctionObject for process `this` separately
  * TODO : ScriptClassMethodFunctionObject, ScriptGeneratorFunctionObject.

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-01 11:30:40 +09:00
Patrick Kim
2a54ab5e02 Update lexical environment stuffs (#327)
* treat variable in catch() as let
* add lexical environment record data into global environment for saving global permanently
* re-implement variable access bytecode generation
* re-implement class initialize operation
* re-implement global variable access bytecode for support lexcial variables in global
* fix bugs related with per-iteration lexical environment in for-statement

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-07-26 13:16:44 +09:00
Hyukwoo Park
f94e8fcd11 Fix ScanExpressionResult in parser to store AtomicString info (#326)
* ScanExpresionResult stores additional AtomicString info to sync with esprima code more intuitively
* scanner for groupExpression module is updated

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-07-25 20:19:40 +09:00
Hyukwoo Park
34867f39fe Enable rest element for arrow function (#322)
* Parser::groupExpression is fixed according to the esprima code
* passed two v8 TCs

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-07-24 10:11:29 +09:00
Patrick Kim
d1b4ced24c Update lexcial environment. (#313)
- Store lexcial block informantion in InterpretedCodeBlock.
- If lexcial block has no lexcial variables, we should collapse the block.
- If there is no heap-allocated variables in lexcial environment, we can skip allocation of the environment.
- Implement Indexed storage for lexcial environment.
- Allocate lexcial variables in function stack storage if possible.

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-07-18 15:34:10 +09:00
Robert Fancsik
ef59096112 Implement the lexical scoping (#285)
This patch introduces the let and const keyword and all the related lexical scoping rules.

Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-05 13:38:11 +09:00
Patrick Kim
c0c83ad0d6 Prepare for implementing es2015 specs (#304)
* Remove ES2015, PROMISE, PROXY, TYPEDARRAY defines
* Change test262 from 5.1 to 2015

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-07-04 15:18:23 +09:00
Hyukwoo Park
6577d2dac9 Merge parsing and bytecode generation process (#297)
* in most cases, parsing and bytecode generation process runs sequentially
* parsing error throws SyntaxError exception inside sandbox and this exception will be catched by the sandbox
* clear up some complicated code

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-07-04 15:17:27 +09:00
Hyukwoo Park
2b145ef54c
Update coding style guide (#296)
* reformat all single logical expression based on the new rule

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-07-03 15:42:41 +09:00
Robert Fancsik
9166b2de38 Implement the generator functions (#270)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-06-10 11:55:14 +09:00
Hyukwoo Park
151e30e24d Remove redundant GC objects in parsing (#261)
* unnecessary GC object/structure in parser removed
* explicitly represent stack-allocated object

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-05-28 13:53:40 +09:00
Zoltan Herczeg
34fa4f3d4f Reduce stack usage of the parser. (#269)
Inline CoverGrammar functions and move the common code into helper functions.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-05-23 17:31:49 +09:00
Hyukwoo Park
6d7312579e Optimize memory allocation of Lexer based on the stack (#266)
* each ScannerResult is now allocated on the stack if it is really necessary
* reduce the reference count overhead for each ScannerResult
* ALLOC_TOKEN macro is newly added for allocation of each ScannerResult token

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-05-22 14:58:52 +09:00
Robert Fancsik
2e588a542b Implement patterns (#222)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-05-15 21:29:55 +09:00
Hyukwoo Park
3c6dee209b Fix bugs in for-of and iterator operation (#253)
* left should not be assignmentexpression in for-of statement
* this object for iterator operation fixed

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-05-14 18:42:21 +09:00
Robert Fancsik
1fc56fcf9a Implement the class language element part II. (#203)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-05-14 09:10:13 +09:00
Patrick Kim
d9976037ce Arrow function can be used as argument (#250)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-05-13 20:10:09 +09:00
Hyukwoo Park
10bf53ab8b Fix to use Marker instead of MetaNode in parsing of arrow function parameters (#247)
* scanner should be indexed on the relative position to the start position of each parsing unit, so Marker is used instead
* test cases for arrow-function are newly  added

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-05-13 11:39:25 +09:00
Zoltan Herczeg
0caf44d918 Remove tolerateError. (#246)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-05-10 13:20:36 +09:00
Robert Fancsik
d788b0b3a9 Add default argument support for arrow functions (#228)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-05-07 18:53:49 +09:00
Zoltan Herczeg
b0f1b83697 Make ScanExpressionResult to behave like an ASTNodeType. (#227)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-05-07 11:19:56 +09:00
Robert Fancsik
cd03a086f1 Implement default arguments (#198)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-04-30 16:42:40 +09:00
Zoltan Herczeg
3ea072676c Remove string value from ScanExpressionResult. (#213)
Only Identifiers use it, so move it into a context member.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-30 12:07:55 +09:00
Zoltan Herczeg
bb90eb50e1 Merge parse/scan catchClause and finallyClause. (#212)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-26 13:39:24 +09:00
Hyukwoo Park
8850b0103f Implement for-of statement (#205)
* merging for-of and for-in statement
* remove unnecessary bytecodes

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-04-23 15:29:40 +09:00
Zoltan Herczeg
11129d6c91 Merge parse/scan switchStatement, labelledStatement and throwStatement. (#204)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-18 19:55:05 +09:00
Zoltan Herczeg
b38439447d Merge parse/scan continueStatement, breakStatement and returnStatement. (#202)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-17 10:10:52 +09:00
Peter Marki
2a15e5b55d Add es2015 rest element (#192)
Co-authored-by: Robert Fancsik frobert@inf.u-szeged.hu
Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-04-16 12:01:30 +09:00
Zoltan Herczeg
f92e1993ce Merge parse/scan doWhileStatement, whileStatement and forStatement. (#196)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-15 12:34:34 +09:00
Robert Fancsik
ae28733902 Implement spread operator (#168)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-04-12 09:24:56 +09:00