Commit graph

924 commits

Author SHA1 Message Date
Boram Bae
f11752b532 Update to support new.target with Class and eval (#489) v2.0.0
* Pass more tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-10-31 13:38:49 +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
DaYea Yim
e1658b8bdb Replaced $(...) instead of legacy backticked ... (#481)
Signed-off-by: DaYea Yim <dyyim@protonmail.com>
2019-10-29 10:58:50 +09:00
Hyukwoo Park
6aa1ede203 Fix bugs about arrow function parsing and toStringWithoutException (#482)
* fix a case that arrow function is located at the first of script
* fix a case that toStringWithoutException is called with no SandBox

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-10-28 17:24:57 +09:00
Robert Fancsik
e137a6ba7e Fix computedLastIndex method (#480)
Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
2019-10-28 12:48:34 +09:00
Robert Fancsik
52940f74ea Fix toLength operation in %TypedArray% constructor (#479)
Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
2019-10-28 12:45:37 +09:00
DaYea Yim
af14cda99b Fix a Useless Use Of Cat (#478)
Signed-off-by: DaYea Yim <dyyim@protonmail.com>
2019-10-28 10:51:06 +09:00
Patrick Kim
f75945700a Fix various things (#476)
* Fixup canDeclareName in ASTContext
* Add more callstack information on API
* Add onDelete callback on VMInstance
* Add BloomFilter as util
* Use BloomFilter in ASTFunctionContext for find out variable name existence
* Optimize parser using InlineStorageVector

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-10-24 14:29:55 +09:00
Hyukwoo Park
bb7c12cfd5 Optimize parser to skip the scanning of the whole function (#475)
* parsing of function including parameter list and function body is skipped in scanner mode
* m_bodySrc in InterpretedCodeBlock is removed because it is no longer necessary
* some operator overloading in FreeableNode and DestructibleNode is fixed

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-10-23 19:40:26 +09:00
Boram Bae
2dc9b08ea7 Implement getFunctionRealm and Fix some bugs related to Array (#474)
* Pass more spidermonkey tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-10-23 18:38:14 +09:00
kisbg
46cde3369d Added toString in builtinArrayToLocaleString (#472)
Enable one V8 test

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2019-10-23 14:24:29 +09:00
Tóth Béla
0d51490abd Fix RegExp check in String.prototype.includes (#473)
Enabled some tests that are corresponding to this check

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-10-21 21:19:42 +09:00
Hyukwoo Park
13343f8417 Optimize memory management in Parsing (#465)
* Revise AST Node allocation through ASTPool

* ASTAllocator is newly added for allocation of AST Nodes
* AST Node is allocated in pool memory and flushed once after bytecode is generated
* All reference counting overhead related to AST Node is removed

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>

* Reduce memory operations in Parsing

* empty vector called SyntaxNodeVector is added for SyntaxChecker
* ASTFunctionScopeContext and ASTBlockScopeContext are allocated in ast pool instead of GC heap
* memory leak(ShellPlatform) in shell is fixed

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-10-21 20:01:17 +09:00
Tóth Béla
0f144eafed Fix position settings in String.prototype.endsWith (#470)
If the second argument is undefined in endsWith() the position
should be set to the length of the string in question.

Enable corresponding v8 test: es6/string-endsWith

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-10-18 12:31:49 +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
Hyukwoo Park
ba161d7459 Fix case when functions located in parameter list (#468)
* functions in parameter list are scanned instread of skipping it
* fix #236 issue

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-10-17 18:46:03 +09:00
Patrick Kim
355c7eff53 Fix errors (#467)
* Fix BDWGC compile option
* Fix build error on ndk
* Global declared function declaration should always create binding

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-10-17 18:28: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
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
Patrick Kim
2b58f8282d Use special vector it has inline storage in esprima::Parser::parseBinaryExpression (#463)
* this special vector reduce malloc/free count on parseBinaryExpression

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-10-15 17:15:52 +09:00
Hyukwoo Park
76e14b2f9d Update issue templates 2019-10-14 19:28:34 +09:00
Patrick Kim
b9a6f92b27 Optimize script initialization performance (#462)
* Build numeral literal number in token only if needs
* Build string literal for ast only if needs
* Move NumeralData from ASTContext to ASTNode
* Fix compile error on gcc 7+

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-10-14 19:18:39 +09:00
Hyukwoo Park
1e459af46c Fix several modules of Parser (#461)
* small-sized SmallScannerResult replaces origin ScannerResult in parsing process to reduce the memory pressure.
* ScannerResultVector in parseBinaryExpression is replaced by GC-independent SmallScannerResultVector to reduce the memory overhead (both the performance and memory usage)
* ParseFormalParametersResult holds SyntaxNodeVector instead of NodeVector because each parameter Node is re-generated when it is really necessary (parsing of function call) and we only needs the name and type of each parameter during the pre-parsing
* parser/scanner of parameter parsing is added
* clear up some unnecessary codes such as each friend class annotation in Nodes and NodeVectors

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-10-14 16:36:57 +09:00
Patrick Kim
4bb343552e Optimize script initialization performance (#458)
* Store child {ASTFunctionContext, InterpretedCodeBlock} as linked-list
* Reduce size of ScannerResult
* Remove Parser::scopeContexts
* Fix compile error in old system

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-10-14 13:07:28 +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
Robert Fancsik
cc0a9a946b Implement String.fromCodePoint (#456)
Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
2019-10-14 09:48:26 +09:00
Robert Fancsik
4b53d82073 Implement String.prototype.codePointAt routine (#455)
Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
2019-10-11 15:32:40 +09:00
Patrick Kim
03ac100d7f Optmize escargot (#454)
* Don't allocate new StringView on parser if possible
* Store esprima::Context::firstCoverInitializedNameError as pointer. it can reduce copy cost on esprima::*CoverGrammar
* Make Script as reexcutable if possible
* Don't save parsed source codes
  - Remove SourceStringView
  - When create AtomicString from StringView, we should make new string data instead of reference StringView
* Reduce size of StringBufferAccessData
* Fix crash in toString of FunctionObject.

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-10-11 15:32:04 +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
Patrick Kim
87ca01b658 Implement indirect export, import (#453)
* Rename ambiguous variables names(src, source, fileName) into src, sourceCode
* Treat 'await' as keyword

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-10-08 18:25:05 +09:00
Hyukwoo Park
65ef38b5f7 Revise parser: specify parser/scanner with two ASTBuilders (#447)
* all parser and scanner methods share common parsing codes, but part of creating a new Node is implemented by two ASTBuilders which are passed as argument
* SyntaxChecker only checks any syntax error
* NodeGenerator checks any syntax error and also creates a new Node
* remove unused Node methods and fix some typo in Node
* esprima::Messages is divided into another header file

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-10-08 14:12:19 +09:00
Tóth Béla
1c37b96edf Enable V8 tests (#451)
Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-10-08 10:18:12 +09:00
kisbg
028e34d28f Fix in GlobalObjectBuiltinMath (#452)
Few Math functions needed a minor fix (min,max,hypot).
Basily if the first agrument was NaN or infinity, then don't convert the other arguments toNumber.

Also enabled one V8 test.

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2019-10-08 10:17:50 +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
81b8992775 Fix [[Get]] length operation for %TypedArray%.set routine (#449)
Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
2019-10-07 19:07:56 +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
Robert Fancsik
89bb5e4c14 Fix the default sort compare function for %TypedArray%s (#445)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-02 09:12:53 +09:00
Boram Bae
67e18df5f3 Update uneval to handle Symbol (#444)
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-10-01 14:48:48 +09:00
Boram Bae
a12e36834c Fix some bugs and add newGlobal builtinFunction to run spiderMonkeyTC (#443)
* Use a byteLength when creating new TypedArray from another TypedArray.
* Keep the isLexicallyDeclaredBindingInitialization value when generating storeBytecode on ArrayPatternNode
* Pass more SpiderMonkeyTCs

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-10-01 10:00:04 +09:00
Patrick Kim
e820e0b969 Revise public API (#442)
* PointerValueRef should inherit ValueRef
* Implement PersistentRefHolder for easy-rooting
* Remove SandBox interface for public
* Re-implement shell through public API
* Implement Platform for supprot various platform easily
* Add many missed public API methods(Set, Map, Symbol...)
* Add Memory class into public

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-09-30 10:55:27 +09:00
Hyukwoo Park
f06cd19f3d Update SpiderMonkey TC (#439)
* uneval builtinfunction is added to run spidermonkey TCs
* fork from https://github.com/mozilla/gecko-dev/tree/master/js/src/tests (commit 6bd2528448bfb148833e9bb6d9b4084296dd342a)
* remove babel files

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-09-26 16:34:01 +09:00
Tóth Béla
8334e67178 Enable es6 v8 tests (#441)
Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-09-26 15:24:49 +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
kisbg
b3e8662953 Fixed null argument in builtinStringNormalize (#440)
also removed few test in V8 skip list

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2019-09-24 16:24:21 +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
Hyukwoo Park
6fa563c68e Update minor syntax errors (#436)
* add invalid hexadecimal escape sequence error
* lexical declaration cannot appear in a single-statement context
* ASTContext structures are divided into another file
* pass more test262 TCs

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-09-20 15:47:50 +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