Commit graph

68 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
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
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
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
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
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
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
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
Patrick Kim
06d13b14ac Add isArrayPrototypeObject, isTypedArrayPrototypeObject on PointerValue (#282)
Add some missing methods in public layer

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-06-10 11:51:36 +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
Hyukwoo Park
64ea29e82b Convert to non-fast-mode array when preventExtensions called (#186)
* first, convert to non-fast-mode and then, set non-extensible
* preventExtensions api is also updated

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-04-08 19:24:55 +09:00
Daniella Barsony
4afdf61b2b Pass const primitive values by value rather than reference (#115)
Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2019-03-18 15:00:31 +09:00
kisbg
02f462a481 Reduce code smell -Remove setPrototype method in constructor/destructor. (#109)
https://sonarcloud.io/project/issues?id=pando-project_escargot&resolved=false&rules=cpp%3AS1699&severities=CRITICAL&sinceLeakPeriod=true&types=CODE_SMELL

Signed-off-by: Bence Gabor Kis <kisbg@inf.u-szeged.hu>
2019-03-04 20:25:32 +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
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
51f10cbe7b Remove unnecessary assertion in the ArrayObject's setArrayLength function (#34)
There's no need to put an assertion there because:
 - The ArrayObject's length can be changed even when it's not extensible, it just fills the Array with empty values.
 - Modifying the length of an ArrayObject should not throw an error, the only time it should when an element is pushed to a non-extensible ArrayObject.

Fixes #33

Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2019-01-04 11:34:25 +09:00
이승수/Tizen Platform Lab(SR)/Senior Engineer/삼성전자
28de827199 Change default license to LGPL license (#60)
* Update build spec file
* Add License files

Signed-off-by: Seungsoo Lee <seungsoo47.lee@samsung.com>
2018-03-07 18:38:28 +09:00
김승현/Tizen Platform Lab(SR)/Engineer/삼성전자
e66f512b32 Implement ES6 Symbol.hasInstance, iterator, toStringTag, toPrimitive and built-ins (#46)
* Implement Array.from
* Disable part of ES6-shim due to wrong implementation

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2018-01-19 15:20:27 +09:00
김승현/Tizen Platform Lab(SR)/Engineer/삼성전자
28f6a51c31 Implement ES6+ String methods, Iterator, Map, Set Object (#43)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2018-01-15 19:58:01 +09:00
김승현/Web Platform Lab(S/W센터)/Engineer/삼성전자
91d02bc621 Sort function can get unstable array. (#30)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-11-25 13:33:56 +09:00
김승현/Web Platform Lab(S/W센터)/Engineer/삼성전자
2d256f0140 Stop using iterator in ArrayObject::sort (#8)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-07-10 19:58:25 +09:00
Saebom Kim
5cefb08f12 1. If there is a deleted element in FastModeArray, it should not skip updating its enumeration data
2. If setObjectPreComputedCase decides to make no more caches because of many cacheMisses, it should invalidate previous caches

Signed-off-by: Saebom Kim sae-bom.kim@samsung.com
2017-04-19 17:13:32 +09:00
seonghyun kim
0e2e594a55 1. divide FunctionObject::call into call and newInstance
2. fix test262(x64) crash
3. process new operation with binded function correctly

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-04-06 14:55:07 +09:00
Saebom Kim
6d4ed41488 1. When 'writable' property of array length turned into 'false', convert it into NonFastMode
2. If RegExp's source needs escapeSlash process, it should count the number of leading backSlashs

Signed-off-by: Saebom Kim sae-bom.kim@samsung.com
2017-04-05 19:28:08 +09:00
Saebom Kim
a904501b75 Combination of [try|catch|with] and controlflows works correctly
- add member m_outerLimitCount into class ControlFlowRecord to save tryStatementScopeCount of the jump destination

* fix bug in Array.prototype.concat()
 - It will check the length of the array overflows or not

* fix bug in setting __proto__
 - when setting __proto__ to non-object, non-null, non-undefined value, it should do nothing

Signed-off-by: Saebom Kim sae-bom.kim@samsung.com
2017-03-28 18:25:45 +09:00
seonghyun kim
811cc9553f 1. setting array.length to writable false while writing length is should correctly evaluated
2. revise Array.prototype.{splice, slice, shift, unshift}
3. change Object::nextIndexForward, Object::nextIndexBackward to return existence of index

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-03-28 14:23:48 +09:00
seonghyun kim
34dad07c79 move VM-bound data into VMInstance from context
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-03-23 18:48:02 +09:00
Saebom Kim
add7a8266d 1. Fix a bug on ArrayObject::defineOwnProperty for "length" property
2. Changed the order of evaluting parameters in Date.prototype.set* series

Signed-off-by: Saebom Kim sae-bom.kim@samsung.com
2017-03-23 14:44:25 +09:00
Saebom Kim
243c8c2c2b implement more about DefineOwnProperty() of ArrayObject
* "length" property of ArrayObject is treated with special flow when defined
* fix bugs in Object::defineOwnProperty() which occured when "value" property is not given

Signed-off-by: Saebom Kim sae-bom.kim@samsung.com
2017-03-22 10:06:53 +09:00
Youngil Choi
e02af7daf8 Add License Clauses
Signed-off-by: Youngil Choi <duddlf.choi@samsung.com>
2017-03-10 18:06:20 +09:00
Junyoung Cho
0d93c8e2fe Seperate original src/heap directory into submodule GCutil and src/heap
Now,
 - GCutil has bdwgc and general GC Utilities (LeakChecker, allocator
         wrapper)
 - src/heap has Escargot-dependent functions (Custom Allocator,
         LeakCheckerBridge for global function support)
2017-02-23 13:21:22 +09:00
seonghyun kim
1b044658fc 1. remove libunwind from Makefile & source
2. disable thread function in bdwgc
3. remove m_version from ObjectStructure
4. add rawBuffer in TypedArrayObject
5. remove wrong usage of Value::toArrayIndex and Value::toIndex
6. optimize String::tryToUseAsArrayIndex, String::tryToUseAsIndex

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-02-13 10:36:25 +09:00
seonghyun kim
0f1cc8999c 1. diet native getter, setter on Object
2. diet ByteCode
3. use get, setIndexedProperty in ByteCodeInterpreter
4. implement get, setIndexedProperty for typed array
5. move implemention of CallNativeFunctionOpcode to FunctionObject::call
6. remove m_contentLength, m_has8BitContent in RopeString
7. optimize ByteCodeInterpreter::getObjectPrecomputedCaseOperation, setObjectPrecomputedCaseOperation
8. diet Arguments object

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-02-13 10:36:25 +09:00
seonghyun kim
e305e378cb 1. add CodeBlock::m_hasArgumentsBindingInParameterOrChildFD for boost FunctionObject::call performance
- hasArgumentsBindingInParameterOrChildFD is computed every function calling before
2. computing ExtendedNodeLOC bug with global CodeBlock when source code has comment at the front
3. add default object structor for arguments object
4. implement Object::getIndexedProperty, Object::setIndexedProperty
5. use SmallValueVector in Env record instead of ValueVector

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-02-13 10:36:25 +09:00
seonghyun kim
3a7541d44e 1. optimize esprima::isIdenifierStart, esprima::isIdenifierPart
2. optimize String::find
3. expand ESCARGOT_ASCII_TABLE_MAX to 256
4. implement ArrayObject::fastGetObject, ArrayObject::fastSetObject for fast ArrayObject access in native source
5. optimize Array.prototype.spice, Array.prototype.push... with ArrayObject::fastGetObject, ArrayObject::fastSetObject

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-02-03 21:43:49 +09:00
seonghyun kim
dbbbdf2374 allocate almost gc objects as typed gc object
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-01-18 20:28:45 +09:00
seonghyun kim
abc8d38ff7 optimize Object::enumeration
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-01-13 14:37:38 +09:00
seonghyun kim
109be415d1 1. remove Increment, Decrement opcode
2. implement fast String buffer access
3. remove hash from AtomicStringMap
4. implement simple dtoa cache

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-01-12 21:30:26 +09:00
seonghyun kim
adc1b3cea1 1. optimze write, read global object in interpreter
2. optimze write, read object in interpreter

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-01-09 20:15:15 +09:00
seonghyun kim
f112dfefd2 1. fix wrong usage of ObjectPropertyDescriptor::NotPresent
2. add ArrayBufferObject

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-01-05 03:24:02 +00:00
seonghyun kim
65e5d5ab7a fix ArrayObject::setFastModeValue
condition of enter NonFastMode is wrong

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-01-04 13:12:04 +00:00
seonghyun kim
9405b56d82 1. fix setting array length bug
2. optimze reduce array length
3. implement escape, unescape
4. implement rest of Array.prototype builtin functions

this patch pass all of test262(5.1)

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-01-04 12:35:54 +00:00
seonghyun kim
2057250e48 implement Array.prototype.indexOf, Array.prototype.lastIndexOf
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-01-04 15:18:58 +09:00
seonghyun kim
7a7d339161 re-implement set ArrayLength
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-01-03 17:51:35 +09:00