Commit graph

126 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
Patrick Kim
bffa9402b1 Optimize execution speed (#374)
* Set ALWAYS_INLINE flag for SmallValue <-> Value convertor function
* Implement ScriptGeneratorFunctionObject for remove if-statement in FunctionCall
* Remove calling Object::call in CallFunction, CallFunctionWithReceiver opcode
* if function uses global variable only, we should not use heap env for the function
* Don't use bitfield for ExecutionState::m_inStrictMode because we have only one flag at there.
* Remove useless submodules (test262-master, test262-harness)

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-19 11:23:23 +09:00
Patrick Kim
ad0cecbd0d Implement lazy-creation of arguments object. (#361)
* Store ArgumentsObject into Env record with functionObject
* Introduce gc memory leak checker
* Don't save stack pointer in ArgumentsObject

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-13 17:00:03 +09:00
Hyukwoo Park
1d143c3871 Expand the parsing scope of function to include parameters (#360)
* we should parse the parameter list together for each function calls to treat argument initializers such as rest, default parameters
* for each function calls, we first parse the parameter list and then, parse the function body sequentially
* also remove and clearup some unnecessary parsing modules

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-08-12 14:02:27 +08:00
Patrick Kim
864973236d Refactoring source code (#356)
* Remove some unused function, variables
* Remove LexicalEnvironment from NativeFunctionObject
* Don't save stack-allocated LexicalEnvironment on ScriptFunctionObject. it may cause memory leak from stack
* Don't store newTarget, ThisBinded value on FunctionEnvironmentRecord if possible(we don't need these values except class functions)

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-08 12:20:19 +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
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
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
Robert Fancsik
ef59096112 Implement the lexical scoping (#285)
This patch introduces the let and const keyword and all the related lexical scoping rules.

Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-05 13:38:11 +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
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
Robert Fancsik
2d7056e5a1 Simplify InterpretedCodeBlock initialization (#145)
Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
2019-03-14 12:03:06 +09:00
Peter Marki
16010c33e1 Throw exceptions by value and catch by reference (#62)
Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-01-23 11:50:52 +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)/Engineer/삼성전자
70afb08b5a Optimize vector, esprima_cpp, bytecode generating (#170)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2018-12-07 14:21:38 +09:00
박혁우/Tizen Platform Lab(SR)/Staff Engineer/삼성전자
42eee4e35b Implement Arrow Function[ES6] (#162)
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2018-11-14 11:29:18 +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/삼성전자
112221ab22 Optimize AST tree & Script parser Scanner functions (#69)
* This patch increase octane score +2~3%(x86 intel)
* We suggest jobs number in third party build even if failed to find cpu core count
  Using -j options cause system fail some legacy system

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2018-05-03 07:29:55 +09:00
김승현/Tizen Platform Lab(SR)/Engineer/삼성전자
b3f8e0105a Optimize ScriptParser & redesign String classes (#68)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2018-04-27 13:06:43 +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
김승현/Web Platform Lab(S/W센터)/Engineer/삼성전자
55ee12d6b0 Improve script parsing performance (#23)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-10-24 15:09:40 +09:00
seonghyun kim
ef71d53298 1. fix bug around catch variable binding, env binding
2. fix bug in StringBuilder
3. add vendor test data xml files

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-05-15 21:55:21 +09:00
Saebom Kim
74869c1ec9 1. remove RELEASE_ASSERT_NOT_REACHED in ScriptParser
2. fix a floating point precision bug in DateObject
3. fix a bug in Math.round() which occured with big integer

Signed-off-by: Saebom Kim sae-bom.kim@samsung.com
2017-05-12 20:18:22 +09:00
seonghyun kim
f234131c6c 1. use right receiver calling setter in GetObjectOperation
2. when evaluate evalLocal operation, flag of inside of with statment should propagate into inside CodeBlock due to using CallInWithOperation instead of CallOperation
3. restict using of RegisterCopySkip mode in CompoundAssigmentNodes
4. In with statement, every continue statement to outer statement is not allowed except label for literation

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-05-11 17:33:45 +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
c4bc84def6 1. optimize esprima_cpp
2. update android bdwgc build flags

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-04-12 21:28:01 +09:00
seonghyun kim
aa0b23d765 1. update android build flags
2. fix typeof bugs

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-04-11 13:12:31 +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
seonghyun kim
98850e4d34 LexicalEnvironment should be allocated in heap with deleteing ID expression
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-04-05 15:59:18 +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
5d56fd2bb4 1. do not ASTScopeContext explicitly. it is used by ByteCode-genaration
2. alloc esprima::Error as Non-GC type.
 - it can be thrown. but, bdwgc can not see try-catch variable area.
3. Use own context when eval, function are invoked.
4. implement fake-Realm class for v8 vender test

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-03-24 19:03:27 +09:00
seonghyun kim
35ceec9680 1. not every binding is mutable in strict mode
- add m_isExplicitlyDeclaredOrParameterName into name info in ASTScopeContext
  - add m_isMutable into IdentifierRecord struct
  - add ThrowStaticExcpetion opcode in indexed-mode
  - add throw exception code in storeByName operation
2. when evaluate delete operation on member variable, must evaluate toString operation once for name even if exception throws
3. in strict mode, Decimals with leading zero literals are not allowed

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-03-22 22:33:34 +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
76a249913a 1. give limit to variable count & register count
2. expand register limit to uint16_t
3. introduce skip copying from stack allocated local variable to interpreter register file

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2017-02-18 00:54:59 +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
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