Commit graph

137 commits

Author SHA1 Message Date
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
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
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
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
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
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
Patrick Kim
e91d0f0fe7 Improve execution performance (#491)
* Make ArgumentsObject light
* Implement lazy-creation of FunctionObject.prototype
* Don't copy ObjectStructor when executing Object::enumeration
* Use GC_REALLOC on Object, ArrayObject

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-11-04 11:18:03 +09:00
Boram Bae
5b43165375 Fix various bugs detected from vendor tests. (#464)
* In Proxy's defineOwnProperty, set settingConfigFalse to true if desc has a [[Configurable]] field and if desc.[[Configurable]] is false
* Use a length properly according to spec at each sort implementations
* Ignore tests where the only reason for the test failure is an error message difference

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-10-15 17:17:51 +09:00
Robert Fancsik
20a1704abe Reduce the size of ObjectPropertyName on x64 (#460)
Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
2019-10-14 10:49:18 +09:00
Boram Bae
b9bb171eac Fix some bugs related to Propertydescriptor and Array (#457)
* Create a property only when each field of desc presents at fromObjectPropertyDescriptor
* Add a ArrayIteratorPrototypeObject
* Call iteratorClose correctly at Array.from

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-10-14 09:50:09 +09:00
Tóth Béla
44e90a6b91 Implement the @@match well-known Symbol (#157)
Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-10-11 14:46:27 +09:00
Boram Bae
069921b3b9 Fix some bugs related to Array and TypedArray (#450)
* Close iterator when throwing an error
* Clamp the Uint8ClampedArray value properly.
* pass more spidermonkey tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-10-08 09:37:31 +09:00
Robert Fancsik
8095a934d6 Add Proxy object support for several builtin operations (#435)
Related methods:
 - Array.isArray
 - JSON.stringify
 - JSON.parse
 - Object.prototype.toString

Also fixed some errors in the Promise builtin rotuines to enable more tests.

Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
2019-09-26 12:33:37 +09:00
Patrick Kim
2173fa4b25 Pass more test262 testcases (#426)
* 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>
2019-09-16 13:25:56 +09:00
Hyukwoo Park
c2352d1722 Fix Spread (#421)
* spread is allocated on an array object in advance to know the entire length of array when it is used in array initializer
* spread array is fixed fast mode array which means that Array.prototype could not affect any array operation of spread array
* pass v8 TCs

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-09-10 16:59:57 +09:00
Robert Fancsik
1df4dcd1a8 Add fast paths for hasProperty internal method (#407)
Also the Object.[[Get]] method is modified to follow the standard requirements without recursion.

Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
2019-09-03 17:14:03 +09:00
Boram Bae
35bf5c2768 Implement IsCompatiblePropertyDescriptor and CompletePropertyDescriptor (#398)
* Pass more test262 tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-08-29 20:27:56 +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
b656248ce4 Refactor code (#396)
* Revise hasProperty and apply it everywhere
* Add hasIndexedProperty for performance
* Change Object::nextIndex{Forward, Backward} double parameter types into int for performance
* in String.prototype.replace, Use test fast path correctly & use old method because newer method cannot support regexp correctly(old method is faster)

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-29 14:35:50 +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
Boram Bae
c62885d607 Fix bugs related to Array built-in functions (#383)
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-08-21 13:55:18 +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
Boram Bae
8e4f170f3f Reimplement [[SetPrototypeOf]](V) and Object.setPrototypeOf(O, proto) according to 6.0 (#377)
* Don't throw type error with Reflect.setPrototypeOf
* Pass more test262 tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-08-19 16:52:09 +09:00
Boram Bae
9dc01183c1 Implement Reflect.ownKeys (#375)
* Fix a bug that the results of [[OwnPropertyKeys]]() were not sorted correctly
* Add internal test and Pass more test262 tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-08-19 11:27:15 +09:00
Boram Bae
31dec6a7b9 Implement OrdinaryHasProperty (O, P), Fix some bugs in ProxyObject (#371)
* Use OrdinaryHasProperty at Object::hasProperty
* Override enumeration for ProxyObject
* Pass more test262 tests
* Exclude test262 tests related to Proxy's enumerate because of that is deprecated in ECMAScript 8.0

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-08-14 18:25:35 +09:00
Boram Bae
ea38d7d96e Implement an '[[OwnPropertyKeys]]()' internal method of Object and refactor some codes (#364)
* Refactor some Object's builtin functions
* Add an ownPropertyKeys public api (getOwnPropertyKeys is deprecated)
* Reimplement Object::enumerateObjectOwnProperies according to spec
* Implement createListFromArrayLike
* Pass more test262 tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-08-14 09:47:36 +08: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
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
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
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
Hyukwoo Park
0671880845 Update isCallable check function according to call operation (#290)
* isFunction is replaced with isCallable check function
* call operations in Promise / TypedArray are fixed

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-06-19 16:51:30 +09:00
Zoltan Herczeg
91dc4ba8f7 Merge ExecutionContext and ExecutionState. (#281)
State without Context is rare, and the merged structure consumes less amount of memory.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-06-19 10:45:00 +09:00
Hyukwoo Park
106b9c8152 Revise bound function based on ES6 (#284)
* add BoundFunctionObject class to represent bound function object
* fix hasInstance operation according to ES6

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-06-13 13:02:39 +09:00
Daniel Balla
f1e3df6832 Modify RegExp property getters, isRegExpObject check (#271)
Fixes `regexp-flags.js` testcase in v8.

Co-authored-by: Robert Fancsik <frobert@inf.u-szeged.hu>
Signed-off-by: Daniel Balla <dballa@inf.u-szeged.hu>
2019-05-29 14:44:03 +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
kisbg
2c421b9673 minor optimization - Remove Object::get recursion (#231)
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2019-05-07 13:39:10 +09:00
Peter Marki
56c247e3a2 Use a copied ObjectStructure in Object::enumeration (#209)
Fixes #128

Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-04-24 16:57:08 +09:00
Peter Marki
95529f563d Implement the Symbol.species well-known Symbol (#140)
Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-04-08 14:11:36 +09:00
Hyukwoo Park
cc546ca624 Update the rest of TypedArray builtin functions Part 4. (#159)
* from, of, get species builtin methods of TypedArray updated
* isCallable and isConstructor modified to commonly used in Value
* Symbol species also updated

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-03-25 15:54:30 +09:00
Hyukwoo Park
82a10e89bc Update Iterator Operations (#146)
* implement getIterator, iteratorNext, iteratorComplete, iteratorValue, iteratorStep, iteratorClose, createIterResultObject method
* fix to correctly use iterator operations based on the ES2015 spec

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-03-15 20:05:21 +09:00
Peter Marki
f56e629bc9 Implement the @@isConcatSpreadable well-known Symbol (#121)
Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-03-13 12:59:10 +09:00
Daniella Barsony
56b7748c67 Reduce code smells (#82)
Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2019-02-19 15:48:48 +09:00
Hyukwoo Park
871829c0fa Fix setPrototypeOf method of Object and Proxy (#76)
* fix setPrototypeOf internal method according to the es2015 spec

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-01-31 18:16:17 +09:00
Hyukwoo Park
40d4fa40c6 Implement Proxy object internal methods (#39)
* updated proxy methods
GetPrototypeOf
SetPrototypeOf
IsExtensible
PreventExtensions
GetOwnProperty
DefineOwnProperty
HasProperty
Get
Set
Delete
ProxyCreate

* TODO
Enumerate and OwnPropertyKeys
Call and Construct

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-01-21 12:22:40 +09:00
Daniel Balla
b7f9750f96 Fix an issue with Object Property Descriptors (#53)
Pass an undefined value as Property Descriptor's `value` property if the previous descriptor's value was not present.

Co-authored-by: Robert Fancsik <frobert@inf.u-szeged.hu>
Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2019-01-17 15:36:05 +09:00
Robert Sipka
aca603a7eb Do not get the object property descriptor`s value if it is not present (#45)
Fixes #28

Signed-off-by: Robert Sipka <rsipka.uszeged@partner.samsung.com>
2019-01-10 14:01:42 +09:00