Commit graph

260 commits

Author SHA1 Message Date
HyukWoo Park
d46a365326 Refactoring type check operations using tag comparison
* type check operations based on tag comparison are updated to be aggresively inlined replacing virtual function calls
* Object, String and Symbol use pre-defined tag values while other uses vtable address as its tag value

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-04-09 16:13:36 +09:00
HyukWoo Park
0f81aa5dce Represent all global error messages by static class members
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-04-03 11:30:10 +09:00
Seonghyun Kim
1bd124fc1b Revise function call & Realm
* Revise Object::getPrototypeFromConstructor. we should get prototype from context of consturctor
* We should pass Optional<Object*> instead of Value with newTarget.
* Give correct prototype value for function prototypes and functions
* Implement %ThrowTypeError% correctly

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-04-02 17:06:53 +09:00
bence gabor kis
52bfc6054b New Feature - Symbol get description
Removed the related test-cases in test262

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-03-26 15:39:55 +09:00
HyukWoo Park
39a5922437 Fix [[Prototype]] initialization process for each object creation
* remove duplicated initialization for [[Prototype]] internal slot
* initialize prototype value directly when each Object created
* each prototype candidate object should be first marked as prototype object
* setGlobalIntrinsicObject marks fixed structure and prototype for global object's intrinsic object initialization

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-03-24 18:26:25 +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
Zoltan Herczeg
0d45add63e Support control flow tracking for loops with empty body and statements with state.
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-03-16 15:38:01 +09:00
HyukWoo Park
d9a9bcf860 Remove duplicated check code in Construct operation
* Object::construct directly calls each internal construct method without any check code
* ByteCodeInterpreter::constructOperation is added to run IsConstructor check code

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-03-12 13:32:31 +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
Zoltan Herczeg
bf3a8c7463 Add support for next and stop operations for the Debugger.
Furthermore the function info is displayed when we stop inside a function.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-03-09 16:17:04 +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
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
21ed849342 Revise iteration
* Reimplement yield * expression
  We should implement yield* expression by ByteCodes
  because we need to pause so many times at single iteration with async generator
* Merge multiple Iteration* ByteCodes into single IterationOperation

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-02-25 13:19:47 +09:00
Seonghyun Kim
81c8c005cf Implement more things about async generator
* Implement Async-from-Sync Iterator Object
* Replace object that used in iteration with IteratorRecord class
* Implement yield expression in async generator correctly
* Move ECMAScript operaton functions(promise*, await, generator, async) into related class

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-02-20 11:36:14 +09:00
Seonghyun Kim
fc5a92554c When call AsyncGenerator, it should be executed until parameter initialize block
+ if test262 test has both IsNegative and IsAsync, we should consider IsNegativeFirst when figure out it ran successfully

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
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
1667e8a360 Update iterator binding for array patterns
* IteratorBind bytecode is newly added to handle the iteratior binding according to the standard (es10)
* iterator binding operations for array element and rest element of array pattern are updated
* IteratorStep related with for-of operation is left as future work

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-01-15 11:15:39 +09:00
HyukWoo Park
febe1b1134 Fix IteratorRecord as normal Object
* handle IteratorRecord and its property by normal Object
* for the ease of accessing and handling in the interpreter

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-01-15 11:15:39 +09:00
Seonghyun Kim
60594853d2 Optimize function.apply(<any>, arguments) case.
* Many JS Frameworks or librarys use `function.apply(<any>, arguments)` pattern.
  but this statement generate arguments object. generateing arguments object is very expensive.
  we can optimize simple cases like `function() {  fn.apply(this, arguments); }`
* Merge many ByteCode opcodes into CallFunctionComplexCase.
* Do gc when allocate large ArrayBuferObject

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-01-15 10:33:49 +09:00
Seonghyun Kim
af9b410fa7 Fix issues in some embedded platforms
* Implement RuntimeICUBinder
 - ICU has verison name on its symbol name like u_tolower_XX.
   but, we need to use escargot on various platform(without re-compile)
   thus, I implement this library
* add ceil function on IEEE754
 - there is an issue with -0 in builtin ceil function
* Use pypy instead of python for running test262(pypy is faster than python)

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-01-09 16:07:51 +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
seonghyun kim
0a79a6c98c Fix crash
* Fix bug in inline cache
* Fix memory error while exiting

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-12-19 10:29:27 +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
a9ca8c58fd Enable direct threading for clang compiler
* In our environment, clang version 6+ supports the direct threading in interpreter
2019-12-09 09:56:36 +09:00
HyukWoo Park
9cf8bc1898 Revise Iterator operations
* iterator and its related operations are renewed based on the ECMAScript2019
* disable one incorrect v8 TC

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-12-05 16:31:25 +09:00
seonghyun kim
0a9ec4f9eb Rename PropertyName into ObjectStructurePropertyName
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-12-05 15:04:20 +09:00
seonghyun kim
875b1aa056 Improving object property accessing performance
* Finding & read desc at once in ObjectStructure
* Improve findProperty performance in ObjectStructure

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-12-02 16:44:27 +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
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
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
seonghyun kim
82c99fc298 Refactor ObjectStructure
* Divide ObjectStructure into 3 types
* Add transition look up hash map into ObjectStructureWithTransition
* Use faster version of log2 on Vector

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-11-12 10:03:03 +09:00
Boram Bae
f2a21038cb Update to handle deleting a SuperProperty
* Pass more tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-11-05 10:27:10 +09:00
Boram Bae
015836c721 Add a ScriptClassConstructorFunctionObject and Fix some bugs (#483)
* pass more tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-10-31 10:19:47 +09:00
Patrick Kim
be2e01a807 Update public API & Remove SandBoxStack (#469)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-10-18 09:40:00 +09:00
Patrick Kim
ba4631ae02 Fix public API errors & fix bugs (#466)
* 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>
2019-10-17 11:20:06 +09:00
kisbg
582c58c8fa Optimized and fixing executeEnumerateObject in ByteCodeInterpreter.cpp (#459)
Basically when we iterated an object's keys, it was not in ascending order.
Also when one of the keys enumerable was changed to false, it was still in the list.
Enabled one V8 test.

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2019-10-16 18:22:43 +09:00
Patrick Kim
eceffac4c4 Implement Direct {Import, Export} (#448)
* 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>
2019-10-07 13:11:03 +09:00
Boram Bae
dd78fda084 Update syntax errors related to 'super' (#438)
* Pass more test262 tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-09-24 16:23:54 +09:00
Patrick Kim
a19b321a5f Implement for statement per-iteration block correctly (#437)
* 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>
2019-09-24 16:15:39 +09:00
Patrick Kim
742e6d29e1 Fix bugs & Implement missed ES6 features (#432)
* 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>
2019-09-20 14:01:36 +09:00