Commit graph

273 commits

Author SHA1 Message Date
Seonghyun Kim
149cac159a Implement OptionalExpression and OptionalChain
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-07-06 10:07:28 +09:00
bence gabor kis
d3e5ec69ce New Feature - Nullish Coalescing (?? operator)
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-06-29 12:34:53 +09:00
Seonghyun Kim
f82c81a5d2 In 64bit, we should use only 32bit for addressing
* Object, Array, Environment record internal space should use 32bit addressing on 64bit
* Rename SmallValue to EncodedValue.
* Implement EncodedSmallValue for using 32bit address on 64bit
* Implement special vectors for EncodedSmallValue.
  - we need these special vector. because when push_back or inserting the value what we want to insert
  can be removed by GC because the parameter type is 32bit(EncodedSmallValue).
* Update GCutil for 32bit addressing on 64bit

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-06-11 17:37:43 +09:00
Seonghyun Kim
5b3f0986b1 Implement lazy part of StaticString
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-06-04 17:12:07 +09:00
Seonghyun Kim
4f3774be0c Implement tagged-template cache on CodeBlock according to GetTemplateObject(templateLiteral) on spec
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-05-27 17:09:09 +09:00
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
HyukWoo Park
912bc2d9ef Improve TypedArray performance
* add element get/set internal method to TypedArray
* internal methods of TypedArray directly access array buffer
* disable inline cache only when property name is related to "Infinity"

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-05-25 16:17:53 +09:00
Seonghyun Kim
9b9f980cfe Reimplement initialize & executing Module according to newer spec
* Update test runner for running module tests in test262

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-05-22 18:34:57 +09:00
Seonghyun Kim
6dec50591f We should create binding even there is virtual ID when executing Script
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-05-15 17:01:55 +09:00
Seonghyun Kim
a9a41ff5f0 Implement missing part of GlobalDeclarationInstantiation and EvalDeclarationInstantiation
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-05-11 16:51:29 +09:00
Seonghyun Kim
a7e53a4524 Fixup minor things
* If we use Object::nextIndexBackward, Object::nextIndexForward with non ordinal object,
  we should not test existence of value for index(we would not call user-defined function)
* Generate more user-friendly callstack

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-05-06 11:27:31 +09:00
HyukWoo Park
c46957de8c Update length-related operations
* remove each unnecessary length method
* getArrayLength and lengthES6 have been renamed
* return type of toLength is changed to uint64_t
* use createListFromArrayLike for more cases

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-04-28 14:48:15 +09:00
Seonghyun Kim
5fe34d5b04 Implement GlobalObjectProxyObject for support external project
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-04-17 12:01:49 +09:00
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