Commit graph

61 commits

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

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-10-31 13:38:49 +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
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
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
c4f82fe5ee When evaluate assigment expression, we should resolve reference on leftside first (#424)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-09-11 17:00:19 +09:00
Patrick Kim
7b7a777f73 Fixup generator (#391)
* we can use let, generator together now.

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-27 12:44:36 +09:00
Patrick Kim
66bd235740 Remove c++ try-catch statement in interpreter function. (#387)
* separate ByteCodeGenerator::m_tryStatementCount into multiple items for implementing es6 generator

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-23 16:55:34 +09: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
876fd29b34 Improve performance (#337)
* Optmize String.protype.split function.
  when separator comes to RegExpObject split function, we have to call @@split function when there is a @@split function.
  old one is correct implementation but performance is bad...
  but we already have optmized split function with RegExp in builtinStringSplit.
  I make to use old one when if user didn't defined own @@split function.
  RegExp test score is changed from 57 to 280 in my computer.

* Make Value::isCallable inline-able.
* Make to use shared data among {Get,Set}GlobalVariable. this may reduce usage & improve performance

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-07-30 18:07:13 +09:00
Patrick Kim
2a54ab5e02 Update lexical environment stuffs (#327)
* treat variable in catch() as let
* add lexical environment record data into global environment for saving global permanently
* re-implement variable access bytecode generation
* re-implement class initialize operation
* re-implement global variable access bytecode for support lexcial variables in global
* fix bugs related with per-iteration lexical environment in for-statement

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-07-26 13:16:44 +09:00
Patrick Kim
d1b4ced24c Update lexcial environment. (#313)
- Store lexcial block informantion in InterpretedCodeBlock.
- If lexcial block has no lexcial variables, we should collapse the block.
- If there is no heap-allocated variables in lexcial environment, we can skip allocation of the environment.
- Implement Indexed storage for lexcial environment.
- Allocate lexcial variables in function stack storage if possible.

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-07-18 15:34:10 +09:00
Hyukwoo Park
6577d2dac9 Merge parsing and bytecode generation process (#297)
* in most cases, parsing and bytecode generation process runs sequentially
* parsing error throws SyntaxError exception inside sandbox and this exception will be catched by the sandbox
* clear up some complicated code

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-07-04 15:17:27 +09:00
Roland Takacs
88b4a94c25 Modify ByteCodeGenerator to have static member functions (#291)
Signed-off-by: Roland Takacs <rtakacs.uszeged@partner.samsung.com>
2019-07-01 16:41:59 +09:00
Roland Takacs
c3039c8b37 Simplify the OpcodeTable initialization. (#267)
Pass null pointers for ByteCodeInterpreter::interpret to indicate
the OpcodeTable initialization. In this case the FillOpcodeTable
opcode can be removed.

Signed-off-by: Roland Takacs <rtakacs.uszeged@partner.samsung.com>
2019-05-23 14:46:24 +09:00
Robert Fancsik
d9005b7891 Improve dump messages for jump operations (#151)
Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
2019-03-22 13:35:14 +09:00
Zoltan Herczeg
b7064e9569 Remove virtual methods of ByteCode. (#126)
To support snapshots in the future, ByteCode class should not have any virtual methods.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-03-06 12:41:35 +09:00
Zoltan Herczeg
29ac4731c9 Move white space and new line checkers into the Lexer. (#81)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-02-13 08:19:28 +09:00
김승현/Tizen Platform Lab(SR)/Engineer/삼성전자
ea7b221a53 Implement initial version scanning function in program when parsing program. (#172)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2018-12-11 13:18:01 +09:00
최현/Tizen Platform Lab(SR)/Staff Engineer/삼성전자
f83bde0cd1 Update macro usages to be compatible with newer compilers (#118)
Signed-off-by: Ryan Choi <ryan.choi@samsung.com>
2018-07-12 13:29:45 +09:00
김승현/Tizen Platform Lab(SR)/Engineer/삼성전자
3968cb26ad Fix line number, column number error in ByteCodeBlock::computeNodeLOCFromByteCode (#99)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2018-06-26 16:12:48 +09:00
김승현/Tizen Platform Lab(SR)/Engineer/삼성전자
c34461310f make test262(ES5) runnable on Windows (#78)
* add icu as submodule
* Fix some wrong implemations
* Remove functions defined on ctypes.h. its implemations slightly different on POSIX and Windows.

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2018-05-14 15:19:55 +09:00
김승현/Tizen Platform Lab(SR)/Engineer/삼성전자
6b76791e32 Make compilable in clang (#71)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2018-05-04 16:44:19 +09:00
김승현/Tizen Platform Lab(SR)/Engineer/삼성전자
ef57dc3400 Optimize ScriptParser more (#70)
* Diet ScannerResult
* Use SourceStringView if possible for reducing memory usage

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2018-05-04 13:44:02 +09:00
김승현/Tizen Platform Lab(SR)/Engineer/삼성전자
fabf1a0209 Use RefPtr & malloc/ free for AST tree & implement Array.prototype.includes (#64)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2018-04-18 11:06:10 +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
seonghyun kim
a9bc1569ee 1. optimize ScriptParser, ByteCodeGenerator
2. fix bug in Array.prototype.splice

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-05-04 19:56:38 +09:00
seonghyun kim
750ba31982 1. reduce memory usage of CallNativeFunction, CallBoundFunction
2. optimize StringBuilder

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-04-14 20:35:14 +09:00
seonghyun kim
a98bf4ec1b 1. add FUNCTION_OBJECT_BYTECODE_SIZE_MAX as config flag
2. divide CodeBlock into CodeBlock and InterpretedCodeBlock for saving memory
3. expand SCANNER_RESULT_POOL_INITIAL_SIZE to 128
4. connect String -> AtomicString with remaining space of String::m_tag
5. optimize Function.bind

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-04-14 13:20:08 +09:00
seonghyun kim
c88d71bfcc 1. call eval function should consider with scope
2. when function name explicitly declared in its scope, initial value of function name is undefined
3. Function ctor should consider comments correctly
4. evaluate MemberExpression correctly
5. reset RegExpObject::lastIndex correctly

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-04-04 17:22:32 +09:00
seonghyun kim
ee1dcad092 1. revise DeclareFunctionExpression as CreateFunction
2. evalute function decl in catch correctly
3. give receiver of get, set in interpreter correctly
4. give right StackTrace information in with, try-catch for user
5. fix bug in argument object around get, set variable

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-03-31 21:30:01 +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
seonghyun kim
b1cc608191 1. reduce size of ByteCodeBlock, CodeBlock classes
2. optimize function calling performance
 - change local variable binding order (this, function name first)
 - revise opcode table init method
3. remove OpcodeTable::m_reverseTable
4. use shared thrower JSGetterSetter instance for arguments, function object
5. revise Function.prototype.toString for to print function's source

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-03-15 22:19:13 +09:00
seonghyun kim
013f0e5d16 1. re-implement arguments binding, CallBoundFunction logic for reduce interpreter loop size
2. optimize FunctionObject::call
3. remove ResetExecutionResult opcode
4. give stack limit of scriptParser correctly

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-03-13 19:23:12 +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
seonghyun kim
f424467d65 1. do not modify spidermonkey.<arch>.org.text when testing
2. implement DeclareFunctionDeclarationsInGlobal, ReturnFunctionSlowCase
3. remove m_canUseDisalignedRegister in ByteCodeGenerator
4. remove ExectuionResult in ExecutionState
5. do multiple array initialization in ArrayDefineOwnPropertyOperation
6. revise FunctionObject::call, UpdateExpressions
7. fix wrong global codeBlock decision in GlobalObject::eval
8. arguments binding can be added in non-indexed mode

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-03-08 23:43:52 +09:00
seonghyun kim
d0561e61be embed small amount of numeral literals into register file of interpreter
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-03-03 18:02:11 +09:00
seonghyun kim
974e986e76 1. replace LoadByStackIndex, StoreByStackIndex with Move opcode
2. generate more optimized byte code in for, if, assignment, update AST node

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-03-02 21:34:57 +09:00
seonghyun kim
f44a2a00a2 1. implement stack limit in Function::call
2. implement stack limit in escprima
3. replace RELEASE_ASSERT_NOT_REACHED() with throwing parse error in esprima
4. impement size limit of String
5. expose config parameters in Escargot.h

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-02-22 16:01:26 +09:00
seonghyun kim
e362acb82d 1. store thisValue in stackStorage instead of ExecutionState
2. remove GetThis byte code
3. optimize Function::call
4. optimize {get, set} of TypedArrayObject

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-02-14 18:32:15 +09:00
seonghyun kim
bf96bca7b0 1. use SmallValueVector for enumerate object in interpereter
2. use direct memory reference instead of in-direct memory reference in GetObjectPrecomputedCase
3. use StringView with String::subString if needed

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-02-13 19:51:14 +09:00
seonghyun kim
272c675e2e 1. sperate ByteCodeBlock::computeNodeLOCFromByteCode
2. implement selective clearing Stack
- only blockes have object, array, new expression are cleared by ClearStack function now
3. improve get object inline cache
4. remove CodeBlock::hasNonConfiguableNameOnGlobal
5. add thisValue in ExecutionState
6. optimize Value::abstractEqualsToSlowCase

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-02-13 10:36:25 +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
Saebom Kim
d2aae57751 Fix some bugs and reduce memory usage from DateObject
* Manage a corner case in computing node LOC from bytecode
  * Change the VM's timezoneID setting to be lazy (because of a memory usage)
  * Fix some bugs on DateObject operation

Signed-off-by: Saebom Kim sae-bom.kim@samsung.com
2017-02-13 10:36:25 +09:00
seonghyun kim
438cdfcb38 1. process \r\n pattern in ByteCodeBlock::computeNodeLOCFromByteCode correctly
2. use stackStorage for "arguments" object
3. do not insert empty name for ASTScopeContext when comes emptyString in FunctionExpression name

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-02-03 13:19:51 +09:00
seonghyun kim
ef9e0ed699 1. reduce ByteCode size with remove loc
2. store ByteCodeLOC in ByteCodeBlock & lazy store loc
3. optimize builtin Array.prototype.splice
4. optimize Value::toNumberSlowCase
5. optimize arguments object

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-02-02 19:14:35 +09:00
seonghyun kim
ca93d380e1 1. reduce stack usage of ByteCodeInterpreter
2. remove memset warning from fillStack

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-01-25 19:25:33 +09:00
seonghyun kim
2fc34d628a 1. use typed allocate for all long-live objects
2. implicitly delete AST when ast is useless
3. allocate String::emptyString correctly
4. hide ptr in LeakChecker for better tracing

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-01-20 15:51:47 +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