A CoverInitializedName such as `{ a = 0 }` (object shorthand with default) is
only valid when the enclosing object literal is refined into a destructuring
pattern. When such an object literal is instead consumed as a real value -- the
base of a member access, call, computed access, or tagged template, e.g.
`( {... { a = 0 }. b = 1 } )` -- the pending CoverInitializedName error was
discarded by a later assignment, so no SyntaxError was raised and the
AssignmentPattern property value reached bytecode generation, hitting
RELEASE_ASSERT_NOT_REACHED in Node::generateExpressionByteCode.
Report the pending CoverInitializedName as an early SyntaxError in the two
LeftHandSideExpression member-access loops the moment the base is consumed as a
value, since it can no longer be refined into a pattern.
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
BindingRestProperty in an object binding pattern only accepts a
BindingIdentifier, unlike BindingRestElement in an array binding pattern
which also accepts a BindingPattern. Throw a SyntaxError when `...` is
followed by `{` or `[` in a declaration context.
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
A `using` declaration in a switch case preceded by another statement
aborted with Assertion `isDisposableResourceRecord()' failed / SEGV in
finalizeDisposable.
The switch releases its discriminant register before generating the
case bodies, but pushLexicalBlock had allocated the disposable-record
register on top of it. The early giveUpRegister therefore freed the
disposable register instead, and a statement in the case body (e.g.
`o.k = 1`) reused that register slot, clobbering the record;
Initialize/FinalizeDisposable then dereferenced a non-pointer value.
When the switch block contains a `using` declaration, defer releasing
the discriminant temporaries until after finalizeLexicalBlock has
popped the disposable register (preserving LIFO order). Switches
without `using` are unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
`L: for (const v of [...]) { continue L; }` aborted with
Assertion `!v.isEmpty()' failed, and `continue OUTER` from a nested
loop silently terminated the script.
A `continue <label>` whose label targets a for-of loop was left to be
resolved by LabelledStatementNode after the loop body, by which point
the for-of iterator-cleanup try block had registered the jump as a
complex case. It was then morphed into a JumpComplexCase that unwound
the try block, wrongly closing the iterator and leaving an empty Value
in the result register.
A previous per-loop attempt (8fd141b2) was reverted (60b1202a) because
a single m_currentLoopLabel leaked into nested loops and broke test262.
Track all labels directly targeting a loop (m_currentLoopLabels), clear
the list when entering each loop body so nested loops never inherit it,
and let for-of/for-in resolve continues for its own labels to
continuePosition (a plain jump, identical to an unlabeled continue)
before the try block is registered as a complex case.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
A continue/break that is the first instruction inside a lexical block which
allocates an environment (e.g. `for(;c;){ continue; eval(); const x=1; }`) was
emitted as a plain Jump, skipping the block's CloseLexicalEnvironment. The
leaked environment then caused a subsequent outer-scope `const` to initialize
in the wrong environment, producing a spurious
`ReferenceError: Cannot access '...' before initialization`.
registerJumpPositionsToComplexCase compared jump positions against frontlimit
(= lexicalBlockStartPosition, the first body instruction) with strict `>`, so a
jump located exactly at the first body instruction was never morphed into a
JumpComplexCase and the block environment was left un-popped. Use `>=` for
break/continue/labelledBreak/labelledContinue.
With the environment now unwound correctly, the hasBinding guard band-aid in
InterpreterSlowPath::initializeByName is no longer needed and is removed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
Remove the conditional labeled continue processing from loop statements.
The LabelledStatementNode correctly handles all labeled continues after the
labeled statement completes. Loops should only handle their own regular
(unlabeled) continues.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
Issue #1571: Labeled continue in do-while loops with allocated blocks
- Proper morphing for labeled continues crossing block boundaries
- Fixes environment record consistency in labeled loops
- Completes fix pattern across all loop statement types
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
Issue #1571: Labeled continue in while loops with allocated blocks
- Proper morphing for labeled continues crossing block boundaries
- Fixes environment record consistency in labeled loops
- Applies fix pattern to all loop statement types
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
Issue #1571 Crash #3: Labeled continue in for-of loop
- Iterator value issue when labeled continue triggered early
- Proper sequencing of iterator cleanup vs control flow
Issue #1571 Crash #4: With statement + labeled for-of
- Environment unwinding coordination with iterator cleanup
- CloseLexicalEnvironment called at correct time
Solution: Consume labeled continues with proper morphing
- Ensures iterator cleanup finalizer runs before unwinding
- Control flow record management stays consistent
- Both for-in and for-of (and for-await-of) properly handled
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
Issue #1571 Crashes #3-4: Labeled continue in for loops
- Consume labeled continues targeting this loop with proper morphing
- Ensures iterator cleanup and environment unwinding work correctly
Issue #1571 Crashes #5-13: Environment record mismatch in labeled loops
- Proper morphing of labeled continues across allocated block boundaries
- Fixes crashes from scope-creating constructs in labeled loops
- Plain Jump path preserved for non-allocated blocks (zero overhead)
Solution: Call consumeLabelledContinuePositions with morphing enabled
- If no allocated block: plain Jump (fast path)
- If allocated block: JumpComplexCase with proper unwinding (correct path)
- Morphing is automatic via morphJumpPositionIntoComplexCase
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
Fix accidental deadlock possible inside the debugger and improve formatting when inspecting arrays.
Signed-off-by: Ádám László Kulcsár <adam.kulcsar@szteszoftver.hu>
skipSingleLine, skipSingleLineComment, and skipMultiLineComment incremented
the source index and then called peekCharWithoutEOF() without re-checking
eof(), causing a one-byte heap read past the source buffer when the input
ends with a bare \r or a trailing '*'. Guard each follow-up peek with eof().
Fixes#1568
Signed-off-by: SAY-5 <say.apm35@gmail.com>
Delete debugger_tester.sh script and rewrite it in python. Also add option to run individial tests.
Signed-off-by: Ádám László Kulcsár <adam.kulcsar@szteszoftver.hu>
Add breakpoint on the start of the first source code line so that module file imports can be debugged.
Also extend debugger test script since Escargot uses realpaths with modules.
Signed-off-by: Ádám László Kulcsár <kuladam@inf.u-szeged.hu>
The type of `m_receiveBufferFill` was uint8_t causing it to roll over
when parsing longer messages from Devtools, causing message data to be
truncated incorrectly.
Signed-off-by: Máté Tokodi <mate.tokodi@szteszoftver.hu>
- Use routing table for request dispatch in DebuggerHttpRouter, for
handling choosing which debugger stack to use based on the http
upgrade request:
- DebuggerEscargot for the python debugger and VSCode
- DebuggerDevtools for connecting to Chrome Devtools
- Parse mesasges with 16bit message size
- Reply to the first few messages chrome sends
- Refactor Debugger:
- Rename DebuggerRemote to DebuggerEscargot
- DebuggerEscargot and DebuggerDevtools inherit from
DebuggerTcp which inherits from Debugger
- Add debugger info to README.md
Signed-off-by: Máté Tokodi <mate.tokodi@szteszoftver.hu>
Processing VSCode watches skips waitForResolvingPendingBreakpoints
(previously having multiple watches in VSC would call this when
processing the first watch, which would process pending messages while
trying to wait for break point changes while in eval mode (not in
waiting mode) and cause and Invalid message error and the closure of the
debgger connection when hitting the second watch message)
Allow '*.mjs' files in the python debugger
Add watches to the python debugger, add test
Signed-off-by: Máté Tokodi mate.tokodi@szteszoftver.hu
* Generate UnicodeIdentifierTables.cpp from DerivedCoreProperties.txt
* Generate YarrCanonicalizeUnicode.cpp from CaseFolding.txt
* Generate UnicodePatternTables.h from UCD
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* Update calendarAdd method
* Use correct era code for ethioaa calendar
* Implement special path for hebrew calendar
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
- Update UnicodeIdentifierTables.cpp to unicode 17
- zero width joiner and zero width non-joiner are not a valid identifier start
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
since calling __tls_get_addr performace is too bad, we should r/w TLS variables with special offset
users can turn on this feature with ESCARGOT_ENABLE_TLS_ACCESS_BY_ADDRESS flag
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* shared structure `BreakpointLocationsInfo` between debuggger and ByteCodeBlock can cause memory leaks
* correctly delete each `BreakpointLocationsInfo`
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* include icu libraries for release
* add build option for deployment
* check the result of deployment in action
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* If there is GC jobs from Script init to Script execution, the ByteCode can be remove by ByteCode prunning. this is wrong
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* fix inline caching to insert a new cache item after validation
* refactor set inline caching method
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
There was a problem running bubble test in web-tooling-benchmark
too many gc were occured because GC_get_bytes_since_gc() cannot track GC_free event
so, I am start to use GC_REALLOC on 64-32bit
and fixes build error with mem_stats profiler(valgrind)
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
Force keep ByteCodeBlock* pointer in calling function routine.
Some compiler don't keep pointer of ByteCodeBlock* in stack when calling function
If don't keep the pointer, we can lose the ByteCodeBlock while GC
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* Convert rootedObjectStructureSet(Vector) into HashSet
* Use inline storage for properties in CreateObjectData
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* Prepare the property and key list before object creation
* The new way reduce size of object structure with transition
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* unregisterToken should be weak reference
* add finalizer for unregisterToken
* fix cleanupSome method
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Store CodeCache for function in same file with Script where it is located
* Implement load function ByteCode when loading Script
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* Compute stack limit correctly through pthread API or Windows internal API
* Store stack limit in TLS(or global) not a VMInstance or ExecutionState
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* Check type on as{*} functions
* Add Context as argument for every callback
* Add Pending job option into evalScript function
* Move few create functions into child class
* Update build files
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* fix stack tracing to correctly add execution state in the middle of multiple state links
* remove redundant checks in stack tracing
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Fix build error on gcc-13
* User can use variables CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR for compile
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* convert Infinity into int64_t not produces same result with x86.
* Unaligned 8-byte access on ARM64 causes SIGBUS
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* Update test262 driver for python3 and windows
* Update DateFormat for windows
* Fix compiler warnings on Win64
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* using cmake instead of maintain another files for windows
* delete own ICU build files for windows
* Fix some bugs running on windows
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* Add dumping function for jsc-stress, chakracore, escargot test
* Fix wrong test datas and drivers
* Fix minor bug in yarr
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* when computuing byteLength of ArrayBuffer,
we should use 64-bit integer regard to overflow
* Adding missing ASTAllocator::clear
* Proxy object should care infinity loop
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* should trigger an exception when callee or target object is indeed undefined in optional chaining
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Use Value(NanInit) function instead of Value(DoubleToIntConvertibleTestNeedsTag, double)
* in armeabi-v7a, Inf to int64_t can return unexpected value
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* Replace strlen with strnlen in BuiltinRegExp
* Don't use compiler builtin atomic operation in ARM
* Atomics.isLockFree(4) always returns true
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* build libescargot as static in android
* Add native shell build in order to run test case on android
* Add missing license text for jni
* Update android shell app
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* schedule analysis actions to trigger on every monday, wednesday and friday
* add coverage result badge in README
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
arm clang optimizer cannot generate correct code
with Value(std::numeric_limits<double>::quiet_NaN())
or Value(std::numeric_limits<double>::infinity())
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* if there is too big expression, bytecode generation can be failed
* fix some errors on 64-bit platform through using int
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* Delete local java ref if needs.
* Create local frame on callback.
* Reference list should be updated when object was deleted.
* We should not store non-js-heap value on java reference list
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* Use PhantomReference and ReferenceQueue instead of finalizer.
finalizer could be called by another thread like FinalizerDaemon and it is deprecated.
* Remove NativePointerHolder::destroy function.
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* add shrink function to resize finalizer list
* shrink the list when about an half of the list is empty
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* replace erase operation of vector with non-memory operations
* erase operation requires additional memory allocations which may incur other GC in sequence
* fix GCutil to make gc finalizer not to be invoked in nested calls
* clearly declare each GC member of ArrayBuffer
* add detached buffer check in TypedArray access
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* for non-argument call case, interpreter may access a too far stack address which will never be read
* fix typos in ArrayExpressionNode too
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Use direct address instead of using offset of program when calling interpreter
* We don't need to restore the pointer of program counter in ExecutionState
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* no need to newly allocate string for string send
* sendString takes a constant string to guarantee that send operation would not modify the original string
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* replace defineOwnProperty with directDefineOwnProperty method
* directly insert new properties for builtin objects
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
Improve Value::Value(double) performance.
Add missing double and int32 type testing on interpreter
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* prototype object of Temporal should be ordinary object
* fix the type of prototype as to PrototypeObject
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* check index property set in DerivedObject::defineOwnProperty method only
* index property check is removed for normal Object because PrototypeObject would check it instead
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* In interpreter we can use ByteTerm* instead of int for program counter
* Too big inline function is not good for performance
* considering utf-16 string is only needed for UChar not LChar
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
After update the excludelist with make_excludelist.py it doesn't gave
information about failing and new passing tests. This patch will fix this.
Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
* set dummy element address to denote non-fast mode array
* represent non-fast mode array without creating ObjectRareData
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* rename tagging operations to clearly recognize typeTag and tag (vtable address)
* add global tag values for ScriptSimpleFunctionObject
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
Add Object::getIndexedPropertyValue method for achive that
the function removes redundant creation of ObjectGetResult.
And Improve TypedArray object reading performance through better implementation
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* undefined value is obtained through GlobalVariableGet bytecode
* convert this case into simple LoadLiteral bytecode
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* debugger always stops at the start of new Script execution
* BreakpointLocationsInfo is added to debugger when Escargot generates bytecode for execution only
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
PrototypeObject always returns true in Object::isEverSetAsPrototypeObject.
thus it don't need another space for mark it was used for prototype object.
this object can reduce a lots allocation of ObjectRaraData
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* switch statement has the last location in switch block which incurs an index error in BreakPoint insertion
* fix switch statement to have the start position after switch keyword
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* `initializeFunctionScript` API is added
* unlike dynamically created function, `initializeFunctionScript` supports debugger
* origin line offset is added for correct source code calculation in debugger
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* ErrorThrowCallback is invoked when an Error is thrown
* ErrorThrowCallback overwrites the result of ErrorCreationCallback
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
Divice get object inline cache into simple and complex cases
the simple case should test just one object chain with plain data property
the complex case should consider every case of inline cache
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
store double can cause type test cost for `the double is Int32`
If store double valus as Value, the test cost disapper
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* DoubleInEncodedValue might have an integer value that is also not a small integer (SMI)
* When converting to Value, DoubleInEncodedValue should be correctly converted to the original value using Value(double) constructor
* fix test runner to run cctest for x86 environment
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
we must convert form of inline cache when find complex case(max index is greater than 1) of get object.
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
I store its tag information in the same location with PointerValues
It can reduce memory access count when finding type
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* if ErrorCreationCallback is registered and this callback already inserts `stack` property for evert created ErrorObject,
we just ignore adding `stack` data into ErrorObject
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* String::emptyString is the default string value of empty AtomicString
* so, mark emptyString as source of AtomicString too
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* we can choose JS source code for debugging target
* selectively generating debugging byte code (breakpoint)
* add debugger init option (--skip=) to exclude certain source code from debugging
* rename debugger functions
* explicitly present the python version for debugger tool
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* remove useless GC_MALLOC_EXPLICITLY_TYPED
typed-malloc information is allocated with each malloc operation
* Implement fast path for ObjectPropertyName
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* PromiseRejectCallback is invoked when a Promise is rejected but it does not have any reject handler
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Implement String with inline buffer. this reduce malloc count & reduce memory usage
* Remove typed-gc-malloc from some classes.
typed malloc classes should have storage for descriptor each malloc.
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* Prevent too many recursive call with RopeString::charAt
* Add option to configure ObjectStructure
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* divide Value::toBoolean into 2 functions for better function call inlinling
* try to avoid call RopeString::flattenRopeString if possible
flatten RopeString for read one char is waste I think
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* directly insert property key when there is no index property name
* add hasOwnEnumeration function because some Objects(Array, Proxy...) possibly have index properties
but we cannot know this in advance with hasIndexPropertyName() function
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
If Escargot is compiled with debugger but run without the debug server
then the Escargot will crash. This patch will fix this problem.
Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
* enable exception in wabt engine because Escargot function invoked from wasm function could trigger an exception
* fix compile warning
* fix Thread to be reclaimed after each wasm function call
* extend wasm gc interval
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* we need to reset ByteCodeBlock only for normal functions
* add assertion to check invalid operation
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
m_complexJumpContinueIgnoreCount, m_complexJumpBreakIgnoreCount are
should follow size of m_recursiveStatementStack
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* turn on parserEnable flag in ScriptParser only
* Always store breakpointLocations in debugger(debugger can be turn on later)
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
for runnung octane, we should make 1.05M copies of FunctionEnvironmentRecordOnHeap.
but almost copies(0.84M) of FunctionEnvironmentRecordOnHeap use under 5 heapStorage.
If we inline heapStorage, we can reduce count of GC_MALLOC.
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* remove stack searching for CompressibleString usage
* add reference counter and update it whenever each StringBufferAccessData is created and descturcted
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
- The debugger callbacks are implemented as class
- Using std::vector for storing data
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
* fix debugger to add breakpoint at the first line
* fix debugger not to insert any breakpoint when compiling dynamic code
* add some assertion code to detect undesirable cases
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
--command takes one string which contains commands to be executed at the start of the program.
The commands must be separated with semicolon.
Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
* Implement port option
* Set 'this' value correctly for eval in debugger
* Implement eval without stopping state
* Implement pumpDebuggerEvents function
* Remove useless variable m_thisExpressionIndex in class context information
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
There was a crash in debugger when a not existing variable was printed or evaluated.
This patch will fix this issue.
Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
* simplify atomicOperation function
* merge all atomic operations into SharedArrayBufferObject's member function
* fix slice builtin method to correctly perform operation atomically
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* rename data related to PropertyHandler
* refactoring ObjectWithPropertyHandler to handle NamedProperty and IndexedProperty both
* add cctest
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* update to common PropertyHandler data and strucuture to represent IndexedProperty and NamedProperty both
* check property name in each ObjectWithPropertyHandler method
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* format check requires double-parsing for the same source string
* format check is necessary to filter out a few format cases only
* in general mode, format check is limited to speed up the function creation process
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* usually property name is delivered as Value format
* replace `TemplatePropertyName` with `ObjectStructurePropertyName` to handle Value format nicely
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* add simple syntax checker method in parser to check parameters and body string
* fix it to check parameters and body string seperately
* add several TCs for this patch too
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
gcc version 5 cannot decide how many bits are require for enum well
if there is enum has type. it generates warning but we don't need to set type into enum for gcc 5
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* enabled by ESCARGOT_USE_CUSTOM_LOGGING flag
* user can registers customized logging through Platform's inherited functions
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
we need to mark enum as unsigned.
because processing enum in msvc is little different
ex) enum Type { A, B }
struct Foo { Type type: 1; }
Foo f; f.type = 1;
if (f.type == Type::B) { puts("failed in msvc."); }
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* according to api, ObjectTemplate should inherit its parent's NativeDataAccessorProperties of InstanceTemplate too
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* for gcc version >= 9.3.0
* fix errors about -Werror=class-memaccess and -Werror=ignored-qualifiers
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* handle exceptional case of function name which is that function name needs to be allocated on the heap with other lexical variables
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* divide BackingStore structure into NonShared and Shared
* update BackingStoreRef API to clarify its usage
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* byteCodeStart parameter is used only for Jump codes
* allocating global variable to represent this code start position instead
* remove all redundant parameter for each dump method
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* remove target specific cmake files and merge it into one cmake file (target.cmake)
* refactoring some cmake commands
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* ThreadLocal manage global values allocated for each thread
* Update PlatformRef to allow users to add thread-local custom data
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* PromiseHook is triggered for each Promise event
* PromiseHook is registered and used by third party app
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* cmake variable initialized with `ON` can be directly used in conditional statement
* fix a minor code defect in ArrayObject too
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* when trying to use index property, we use only 32bit for index value (uint32_t)
* rename ArrayIndex as to Index32 and IndexProperty
* add cctest to verify the new api
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Each chain piece represents one of class
* User can uses private member with same name parent with child class
* We should check nearest [[homeObject]] of function to find where function is located
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* add CodeCache routine for ComplexSetObjectOperation and ComplexGetObjectOperation
* fix to use c++ style cast
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* update ObjectGetResult::convertToPropertyDescriptor
* directly convert ObjectGetResult to ObjectPropertyDescriptor instead of creating a new Object for descriptor
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* wabt allocates a Thread object for each wasm func call but it's never reclaimed
* invoke collectHeap right after each wasm_func_call
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* replace each Object's member marking with Object::fillGCDescriptor
* BigInt allocation is fixed to be handled by simple GC_MALLOC_ATOMIC call
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* add relocation case for freeze function address
* remove empty strings from ByteCode and ByteCodeBlock literal list
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* data block of memory can be changed by previous memory.grow operation, but it cannot be reflected to its correlated WASMMemoryObject
* So, buffer getter first checks any change on its related memory and reflects it if there was modifications on it
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Enable for await statement for Global Module code
* Disable html comment when parsing module code
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* handle class constructor as a virtual parameter which is passed for static field initialization function
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* old-version gcc cannot handle this feature
* designated initializer is a C99 feature which is not adopted into C++
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* throw error if function or class declaration is not located at the top level or inside a block
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* remove JumpByteCode and add JumpFlowRecord which has no pointer value
* simplify JumpFlowRecord data caching
* fix coverity issue
* add log message for code cache
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* manage global variables as VMInstance static members
* access global variables through VMInstance static functions
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* String values in m_namedGroupToParenIndex are referenced by m_captureGroupNames (GC vector)
* m_namedForwardReferences only needs to be allocated as GC vector
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* bf_context_t is now defined as a global variable and maintained during the runtime
* VMInstance::finalize is invoked at the end of program to guarantee the life time of bf_context_t
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Init YarrPattern::m_body variable
* Remove Objects finalizer in finalizer of WeakMap,Set
* Use correct finalizer for Intl Objects
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* fix github actions to use python2
* fix clang 10.0.0 build error related to '-Wdeprecated-copy'
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* wrap initializer expr into virtual arrow function like instance field
* users can access super property in eval
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
https://tc39.es/proposal-weakrefs/#sec-weak-ref-objects
removed most of the related test-cases in test262 skiplist
The few remaning test-cases are base on FinalizationRegistry.prototype.cleanupSome, which i didn't find any documentation on.
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
* add wasm_extern_vec_delete_with_size api to handle exception cases during the imports reading
* wasm_extern_vec_t is now correctly deallocated
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
related test262 test-cases has been removed from the skip list
Except two test since it needs FinalizationRegistry feature
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
* fetch the lastest commit which includes importtypes patch
* add wasm_instance_func_index api for function name
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* each extern pointer(wasm_ref_t*) should be compared by wasm_ref_same
* Vector structure is used instead of HashMap since we cannot calculate hashvalue of wasm_ref_t
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* add constructor and exports getter of Instance object
* update operations about imports and exports
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* remove ValueVector member in WASMTableObject
* update Table builtin methods based on the latest spec
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* add ExportedFunction and WASM host function
* update WASMHostFunctionEnvironment for host function call
* refactoring inlined WASM operations
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* add exports function
* update imports function but disabled now because wabt do not support import* apis
* update customSections skeleton code too
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* to support WebAssembly.Memory
* ArrayBufferObject with external memory does not handle any memory operations like malloc/free
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* pass more TCs about Module
* fix wasm-js test script to include several script files at once
* update wasm-js TC
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* replace some common builtin WASM operations with static functions
* implement a part of WebAssembly.compile method
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* merge error messages related with constructor methods
* add throwBuiltinError method for simple messages
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* remove redundant GlobalObject's members related to WebAssembly.Error constructor
* fix throwBuiltinError method to throw WebAssembly.Error correctly
* make a new directory for wasm
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* fix JumpIfEqual bytecode correctly
* rename Jump* bytecode to represent its operation more intuitively
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* https://www.ecma-international.org/ecma-262/#sec-IsHTMLDDA-internal-slot
* IsHTMLDDA internal slot is an ECMAScript feature for Web Browsers
* IsHTMLDDA is currently enabled only for test mode (we can enable it later if it is really used by third party app)
* some related operations are optionally fixed
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Optimize String.prototype.trim method
* Turn off slow tests in test262. these tests are failed on some machine due to timeout
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* If the parser gets -1, the parser divide -1 into UnaryMinus and LiteralNode.
* This patch remove UnaryMinus and change Literal value negative
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* Escargot version is calculated based on commit id
* If git is not available, RELEASE_VERSION is used instead
* Escargot version is used to identify the version of code cache
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* CodeCache holds a lock of cache directory that should be released immediately when it is no longer necessary
* since GC may reclaim VMInstance and its CodeCache member lazily, so destructor of CodeCache could be called later too
* invoke CodeCache clear() in clearCachesRelatedWithContext method to resolve this issue
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* set the member pointer of CodeCacheReader and CodeCacheWriter as nullptr right after free operation to prevent an undesirable case when each destructor invoked later
* add logs for cache read errors
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* remove unused functions
* remove unused variables
* mark necessary but unused variables with UNUSED_VARIABLE
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* to keep overall file operations as small as possible,
remove only the least recently written cache file
* trigger cache replacement when the number of cache reaches the limit
* add octane loading TC for codecache test
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* add cache list count to the cache list file
* add cache error logs
* use stat to check file existence
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* first, try to lock cache directory to enable CodeCache
* if file I/O fails, stop caching and remove all cache files
* flush and sync files when writing cache
* add tests to check file error cases
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* calculate cache file directory based on $HOME env
* handle all cache list in one file
* use source code's hash value for its cache data file name
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* CodeCache generates one meta file and data file for each JS file
* enable coverity scan to check CodeCache too
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* add cctest, debugger test and clang build jobs
* disable travis and some jobs in Jenkins
* enable coverity scan only for push event
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* nested class expression right after the expends keyword should be handled outside of the outer class block
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* handle ThrowStaticErrorOperation bytecode with default error message
* LoadRegexp bytecode could have empty string as its option string
* test on new-es benchmarks
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* turn off ALWAYS_INLINE in small config
* turn off hidden class transition table in small config
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* for typeof operation within arrow function, arguments object should be accessed from the outer environments properly
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* ByteCodeBlock does not hold location data info anymore
* location data of each bytecode is manually allocated only for stack-tracing or debugger mode
* duplicated String allocation for source code is removed
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* In small config, we turn off SyntaxChecker for small binary size
* CompressibleString should get VMInstance instead of Context
* If ICU is disabled, we don't need unicode information in yarr
* Remove unused variable in yarr(RegExpJitTables)
* Fix lz4 compile error
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* Implement one of parsing error of module
* Fix one of stack usage error on FunctionObjectInlines
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* extract infrequently used m_rareData member from InterpretedCodeBlock
* InterpretedCodeBlockWithRareData handles InterpretedCodeBlockRareData inside itself
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* NativeCodeBlock is newly added for NativeFunctionObject
* all interpreter-related info is moved into InterpretedCodeBlock
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Add cctest for Object, FunctionTemplates
* Fix one of EncodedValue <-> EncodedSmallValue conversion bug
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* for development of ECMAScript 2020 standard
* test262 commit ef12a8b11c4dc1222097df4e7ea87a441d82262a
* use script to automatically update excludelist.orig.xml file
* tools/test/test262/make_excludelist.py --arch={x86|x86_64} --engine={ESCARGOT_PATH}
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
Since the debugger breakpoint generation requires a continuously increasing series of LOC indices
the statement node infos should be constructed in the beginning of their parsing functions.
Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
* Object, Array, Environment record internal space should use 32bit addressing on 64bit
* Rename SmallValue to EncodedValue.
* Implement EncodedSmallValue for using 32bit address on 64bit
* Implement special vectors for EncodedSmallValue.
- we need these special vector. because when push_back or inserting the value what we want to insert
can be removed by GC because the parameter type is 32bit(EncodedSmallValue).
* Update GCutil for 32bit addressing on 64bit
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
if we use a regexp that contains Unicode and Global flag
and we match a string that contains more then one of the same letter
then the last index is going to be set wrongfully
for example :
var a = /t/ug;
print("ttt".match(a))
output should be: t,t,t
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
* Set value as undefined when there is SyntaxError
* Fix memory leak related with throwing esprima::Error
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* update definition of ArrayBufferView, TypedArrayObject
* access each TypedArray through TypedArrayObject transition instead of ArrayBufferView
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
The line info for each breakpoint can be calculated from the LOC index.
This patch resolves the problem, mentioned in #649.
Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
* Implement export * as {name} from {src} feature
* Update Script::resolveExport for following new spec
* Update test262 driver for running test cases correctly
* Implement changes of ModuleNamespaceObject::[[*]]
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* Export default function declaration should treat as function declaration
* But there is no name on export function decl, we should the statement as function expression
* Check duplicate export name correctly
* Don't include FIXTURE files as testset in test262
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* add element get/set internal method to TypedArray
* internal methods of TypedArray directly access array buffer
* disable inline cache only when property name is related to "Infinity"
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
When there is no "throw" method when got exception while executing yield* expression,
We should throw "yield* violation. There is no throw method on iterator Object" TypeError.
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* run jetstream only for release-32bit
* run test262 by release mode in 64bit
* for test262, add --fast-mode to run the TCs fastly in debug mode
* fix minor bug about type transition
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* implement and apply CanonicalNumericIndexString for index calculating
* use size_t type for index variables instead of unsigned
* skip a non-standard TC in SpiderMonkey test
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
but I don't want to add extra bytecodes for this.
and It is only needed when there is direct eval operation.
so I wrap each parameter block with small arrow function.
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* When there is arrow function on class ctor, we should use heap-allocated lex env for class ctor.
because we need to compute this variable on run-time
* when there is super expression with computed case, we should load this binding first for testing binding
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* update ArrayBuffer using TypedArrayHelper
* fix a bug related to length of ArrayBuffer on 32bit
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* ArrayBufferObject methods are updated
* some part of builtin methods in TypedArray reworked based on ES10
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Object.prototype.toLocaleString should use this value correctly
* ICU 67 doesn't format near minus zero value correctly, so we should disable test
* we should provide stack info correctly when there is try-statemenet
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* compress the size of ObjectPropertyName to 4byte for 32bit platform
* use tag bit to represent the type of ObjectPropertyName
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* If we use Object::nextIndexBackward, Object::nextIndexForward with non ordinal object,
we should not test existence of value for index(we would not call user-defined function)
* Generate more user-friendly callstack
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* toString builtin method of TypedArray is initialized to the value of Array.prototype.toString
* allocateArrayBuffer and cloneArrayBuffer are revised according to ES10 standard
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* remove each unnecessary length method
* getArrayLength and lengthES6 have been renamed
* return type of toLength is changed to uint64_t
* use createListFromArrayLike for more cases
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* update fast path for one-byte strings
* update special casing conversion
* handle toLower/toUpper correctly using icu methods
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* replace CreateBuiltinFunction with ExtendedNativeFunctionObject
* apply to proxy and async generator
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* when a Proxy object is allocated as prototype of ArrayObject, fastmode optimization is immediately turn off
* revoker should be anonymous function
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* type check operations based on tag comparison are updated to be aggresively inlined replacing virtual function calls
* Object, String and Symbol use pre-defined tag values while other uses vtable address as its tag value
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Update constructor of Intl.Collator to follow new spec
* We should respect order of resolvedOptions object
* We should ignore default value of "kn" at canonicalLangTag function
* We should ignore followed string after "-x-" when parsing collator options
* Replement resolveLocale builtin to follow new spec
* If usage of Collator is "search", we should append "-co-search" on locale string
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* Give correct prototype into Intl Objects
* Implement Array.prototype.toLocalString according spec
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* toFixed, toExponential and toPrecision builtins of Number.prototype updated
* expand buffer size according to the digit range
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Revise Object::getPrototypeFromConstructor. we should get prototype from context of consturctor
* We should pass Optional<Object*> instead of Value with newTarget.
* Give correct prototype value for function prototypes and functions
* Implement %ThrowTypeError% correctly
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
Declarations with assignment should insert breakpoints, while
declarations without assignment should not.
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
* isArray is updated as an internal method of Object
* legacy internalClassProperty is nowhere to be used
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* remove ArrayIteratorPrototypeObject
* fix ArrayIteratorPrototype.next to throw a TypeError for detached buffer
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
The runner clones down the files into test/kangax,
patches it with escargot, copies the runner into it,
and finally it runs and prints the results.
Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
To use the Escargot Debugger test system.
First the Escargot needs to be build with the -DESCARGOT_DEBUGGER=1 option, then
run the ./tools/run-test.py with the escargot-debugger command
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
* GlobalErrorObjectPrototype, DatePrototypeObject, RegExpObjectPrototype, SetPrototypeObject and WeakSetPrototypeObject are removed
* fix some intrinsic prototype object to be an Object instance
* rename prototype class names
* builtin methods of Date are simplified using macro
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* remove duplicated initialization for [[Prototype]] internal slot
* initialize prototype value directly when each Object created
* each prototype candidate object should be first marked as prototype object
* setGlobalIntrinsicObject marks fixed structure and prototype for global object's intrinsic object initialization
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
Allowing U+2028 (LINE SEPARATOR) and U+2029
(PARAGRAPH SEPARATOR) in string literals
defined in ECMAScript 2019.
Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
* caller extension of ArgumentsObject is removed from recent ECMAScript standard
* __proto__ on object expression is changed.
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* %PromisePrototype% is an ordinary object but not a Promise object
* PerformPromiseThen returns Object pointer
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* each builtin constructor of intrinsic object gets prototype from GetPrototypeFromConstructor
* Reflect constructor is fixed to pass newTarget to Construct operation
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Object::construct directly calls each internal construct method without any check code
* ByteCodeInterpreter::constructOperation is added to run IsConstructor check code
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Treat single `let` as Identifier in parsing ExpressionStatement
* The `let` contextual keyword must not contain Unicode escape sequences.
* U+180E had been changed to `Other, Format [Cf]` from `Separator, Space [Zs]`
see https://github.com/tc39/ecma262/pull/300, https://github.com/Microsoft/ChakraCore/issues/2120
* The `let` contextual keyword must not contain Unicode escape sequences
* We need to allocate new env on right side of for in-of head when there is lexical decl on left side
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* Since each length of internal slots in ExtendedNativeFunctionObject is fixed
internal array member is more effective than normal Vector in memory aspect
* Remove some redundant code in PromiseObject
* Apply ExtendedNativeFunctionObject to Promise feature
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
Changes has been made in ProxyObject::internalClassProperty,
since if we use toString method on a ProxyObject the current output would be
[object Type] where the Type can be Object,Array,Function, etc. But before the
changes the output was Proxy ( [object Proxy] ) regardless of the target's type.
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
* Implement basic behavior of for-await-of statement
* for statement should allow `for (..) let {}` form
* Fix bug in yield*
* AsyncFromSyncIteratorContinuation is changed on newer drafted spec(11.0). I apply the change.
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* Generator is also executed until parameter initialize block when generator function is called
* Generator method in object should indicate correct place to start
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* Reimplement yield * expression
We should implement yield* expression by ByteCodes
because we need to pause so many times at single iteration with async generator
* Merge multiple Iteration* ByteCodes into single IterationOperation
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* Implement Async-from-Sync Iterator Object
* Replace object that used in iteration with IteratorRecord class
* Implement yield expression in async generator correctly
* Move ECMAScript operaton functions(promise*, await, generator, async) into related class
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* during the parsing of regexp, some string objects are dynamically generated
* fix m_captureGroupNames vector to be allocated on GC heap for capturing of these dynamic strings
* m_captureGroupNames would be cleared when YarrPattern deallocated
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
+ if test262 test has both IsNegative and IsAsync, we should consider IsNegativeFirst when figure out it ran successfully
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* apparent Identifier name is directly added to getter, setter function
* remove one LoadLiteral bytecode for each name of getter, setter function
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* add symbol name for property method if it is not an empty symbol
* MetaNode in parseLabelledStatement is fixed correctly
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* fix function length to represent the number of consecutive identifiers from the start of parameter list
* collect parameter names including the target names of patterns and rest element
* separate function length and parameter count
* simplify the process of parameter collecting and rename parameter related functions more intuitively
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* fix the order of BindingRestElement bytecode generation
* add implicit name for lexical binding
* reset firstCoverInitializedNameError for for statement header
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* fix to compare string/symbol correctly in marking enumerated key
* fix iterator close operation to call 'return' function of iterator and then throw exception
* add implicit name in object property parsing
* resolve each target of pattern first, and then store the value into it
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Fix parser error related with async arrow function
* CodeBlock may have diffrent source code start position data(from `function` keyword)
- new ECMAScript spec says we should make function source string from `function` keyword
* Apply new spec on builtin Function constructor
* AsyncFunctions must have correct initial properties
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* assignment in array/object pattern has conditional implicit names of class expression
* ClassExpression which also has 'name' static member should not have a implicit name
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Create new promiseCapability when async function called
* __{define,lookup}{Getter,Setter} should follow spec
* builtin String html functions should have correct name
* Fix parser bugs
- allow `{ let e; { function e(){} } }` case in parser
- disallow `try {} catch(e) { function e() {} }` case in parser
- recover await state correctly
* Date.prototype.setYear should use toInteger for input
* update tools/test/test262/make_excludelist.py and its resource
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* script automatically generates the excludelist.orig.xml file by running the current escargot binary
* ./tools/test/test262/make_excludelist.py --arch=x86 --engine="./out_linux_release/escargot" (default: --arch='x86_64' --engine='PROJECT_ROOT/escargot')
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* IteratorBind bytecode is newly added to handle the iteratior binding according to the standard (es10)
* iterator binding operations for array element and rest element of array pattern are updated
* IteratorStep related with for-of operation is left as future work
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* handle IteratorRecord and its property by normal Object
* for the ease of accessing and handling in the interpreter
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Many JS Frameworks or librarys use `function.apply(<any>, arguments)` pattern.
but this statement generate arguments object. generateing arguments object is very expensive.
we can optimize simple cases like `function() { fn.apply(this, arguments); }`
* Merge many ByteCode opcodes into CallFunctionComplexCase.
* Do gc when allocate large ArrayBuferObject
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* 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>
* check and convert to strict mode ahead of following tokens
* identifier which has a valid keyword in strict mode is also converted to the complete keyword
* fixes#513
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Implement RuntimeICUBinder
- ICU has verison name on its symbol name like u_tolower_XX.
but, we need to use escargot on various platform(without re-compile)
thus, I implement this library
* add ceil function on IEEE754
- there is an issue with -0 in builtin ceil function
* Use pypy instead of python for running test262(pypy is faster than python)
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* 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>
* add CompressibleString to compress/decompress large-sized source code
* add ENABLE_SOURCE_COMPRESSION flag (you can use the CompressibleString by build with -DENABLE_SOURCE_COMPRESSION flag)
* use lz4 compression algorithm (from https://github.com/lz4/lz4, the latest release v1.9.2)
- add Escargot::LZ4 namespace
- pull included lib header files out of Escargot::LZ4 namespace
- code format changed by tools/check_tidy.py
* default outdir in config.cmake removed
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* 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>
* fix bugs about object, array destructuring in catch clause
* directly generate bytecode about lexical variable initialization instead of allocating a temporal AssignmentExpressionNode
* RegisterReferenceNode removed because this node is used only during the bytecode generation process
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Treat let, const variables in switch statement correctly.
* When Evaluate switch case block, We should set script execution result as undefined.
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* iterator and its related operations are renewed based on the ECMAScript2019
* disable one incorrect v8 TC
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* 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>
* Finding & read desc at once in ObjectStructure
* Improve findProperty performance in ObjectStructure
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* update exponential operation and exponentiation-equal assignment
* unnecessary header files are removed in some Node files
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
Enabled some tests from the updated test262 repository,
and fixed errors, that were corresponding to them.
Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
Removed code from Trim, moved to TrimString, implemented
the calls from TrimStart, TrimEnd and Trim. Aliased
TrimRight and TrimLeft onto TrimEnd and TrimStart.
Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
* handle implicit function name in parameter list
* handle trailing-comma and also support the trailing-comma rule in setter function
* fix function length not to count parameter-forms other than simple identifier
* disable one wrong TC in v8 (trailing-comma)
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Boolean operator overloading in Value checks if this Value is empty or not. There was a bug in the operator overloading for 32bit mode which just returns the entire value.
* this patch removed the operator overloading instead of fixing the bug because explicit check by isEmpty is more intuitive
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* BindingRestElement bytecode handles Iterator and EnumerateObject both
* MarkEnumerateKey bytecode is added to mark visited properties
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* 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>
* 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>
* add empty async related Nodes
* await and async are handled as a normal identifier
* add const keyword for passed NodeList reference in Node constructor
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* replace NodeVector by NodeList to completely separate the parsing memory from the GC heap
* each node of NodeList is allocated in AST pool
* NodeList passed as lvalue reference
* remove redundant constructor of each Node
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* 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>
* Initialize function name binding in interpreter
* If there are so many var variables on function, we should make hash map for finding var fast
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* 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>
* 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>
* 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>
* 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>
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
* 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>
* 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>
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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
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>
* Close iterator when throwing an error
* Clamp the Uint8ClampedArray value properly.
* pass more spidermonkey tests
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
* 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>
* 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>
* 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>
* 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>
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>
* 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>
* 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>
* 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>
* parseFunction is divided into FunctionDeclaration and FunctionExpression to handle the function name differently
* let, yield keywords are enabled in some cases according to the standard
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Also use SuperSetObjectOperation for super node when not a precomputed case in generateStoreByteCode in MemberExpressionNode
* Update vendor test submodule
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
* Process 0x2028, 0x2029 char on template literal correctly
* Object are created by TaggedTemplateLiteral are should frozen
* When eval `super.foo = 1`, use `this` as receiver
* Implement Function.protoype.caller
* Fix processing '\0' char bug in builtinFileReadHelper
* When eval `yield delegate` repect it's result.
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* 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>
* add syntax check for single parameter in arrow function
* use of parsePropertyMethod is fixed upto the latest esprima version
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Fix some bugs related to Intl
* Use default timezone from VM instance
* The following functions should use Intl when the js engine supports Intl.
Number.prototype.toLocaleString ([ locales [ , options ]])
Date.prototype.toLocaleString ([ locales [ , options ]])
Date.prototype.toLocaleDateString ([ locales [ , options ]])
Date.prototype.toLocaleTimeString ([ locales [ , options ]])
* This patch fixes#251
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
* 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>
* implement reinterpretExpressionAsPattern parsing method for conversion between ExpressionNode and PatternNode
* remove redundant modules in Patterns
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Fixup class parsing error check in esprima
* Class cannot have property named 'prototype'
* When define {getter, setter} in interpreter, property key can be symbol
* Reorder properties on class constructor
* Fixup public API
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* add check code for ObjectPattern without AssignmentPropertyList
* handle the case when value of PropertyNode is a MemberExpression
* add generateStoreByteCode module for SpreadElement
* pass related TCs in test262
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Update yarr (webkitgtk-2.18.5) & import into repo
* Implement new RegExp ES6 error when unicode flag is on
* Fix ignorecase bug on RegExp
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* Pass more test262 tests
* Copy and modify test262/harness/testIntl.js because it does not work in strict mode by referring to a variable without declaring it in the original
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
* declarations of block scoped variables are correctly handled
* const variable check is added to GlobalEnvironmentRecord::setMutableBindingByBindingSlot
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
Also the Object.[[Get]] method is modified to follow the standard requirements without recursion.
Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
* simplify bytecode generation of ArrayPatternNode and ObjectPatternNode by implementing generateStoreByteCode method
* fix bugs related to variable declarations by patterns
* remove unnecessary members in pattern
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Test zero started number correctly
* global Date, Number prototypes should have "Object" on [[class]] internal property
* global {*}Error have Error.prototype in [[prototype]] prototype
* Should call iteratorClose function on When get exception on {Map, Set, WeakSet, WeakMap} constructor.
* Math.imul.length is 2
* Some global Object util functions don't require Object as first parameter from ES6.
* Re-implement Promise.{all, race} for using iterator correctly
* Fix template literal token start position bug in Lexer
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* 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>
* Move es2015, regression-test, intl to js_vender_tc/Escargot directory
* Modify each test path in run-test.py
* Change a test command 'intnernal' to 'ModifiedVendorTest'
* Now, if you need to add an escargot internal test, PR to js_vender_tc repo
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
* Use a 'hasValue' to check whether desc is undefined or not.
* Throw a TypeError if the target descriptor's setter is undefined In ProxyObject's [[set]]
* Add an internal Test
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
* We can use try-catch with yield together now.
* Implement return, throw function in GeneratorObject correctly
* yield expression parsing in esprima 3.1.1 is wrong. so I get right version of yield parsing from newer version of esprima
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
Before the patch escargot called while doing `P.toPlainValue` which causes `[number]`
property names to be converted into numbers, instead of using them as property keys
and passing them along as string, while it should pass string or symbol by definition
in:
http://www.ecma-international.org/ecma-262/6.0/#sec-ispropertykey
Co-authored-by: Robert Fancsik frobert@inf.u-szeged.hu
Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
* Pass more tests
* Replace the wrong test262 tests with internal tests.
* Use test result file at tools dir in chakracore test in run-test.py
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
* CodeBlock has essential parameter name list only
* toString builtin function is fixed to use the entire source instead of body source
* some TCs are fixed upto the spec
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* each parameter is initialized by bytecode execution
* patterns in parameter list are no longer allocated in the heap in default
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* separate ByteCodeGenerator::m_tryStatementCount into multiple items for implementing es6 generator
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* check duplicated parameter names at once
* temporal nodes are allocated on stack
* remove unnecessary structs and flags
* sync parsing part of default parameter to that of esprima code
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* Inline Object::getPrototypeObject function in inline-cache functions(interpreter)
* Use POINTER_VALUE_STRING_TAG_IN_DATA, POINTER_VALUE_SYMBOL_TAG_IN_DATA for finding PointerValue type quickly
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
- 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>
* 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>
* 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>
* 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>
* Add ESCARGOT_ASAN options for debug
* Throw statement should have correct line:column number
* Fix bug in sunspider-js in test driver. if we want to run sunspider test cases at once, excution order is important because some test ruins GlobalObject
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* 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>
* arrow function body is skipped in scan mode to match parseSingleFunctionChildIndex consistently with normal function body block
* extract parameter names right after pushing a scope context
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* 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>
* 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>
Save argc, argv on ExecutionState is enough.
and if function call is end, argv member on env points wrong place.
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* 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>
* Mark ScriptFunction instance created by GeneratorFunction constructor as GeneratorFunction
* handle restricted function properties in various cases
* Pass more tests and add internal tests
* Exclude accidentally passed test
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
Since labels are properly checked by the parser now, there is no
need to check them at the byte code generation phase.
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
Fixed a bug when an arrow function with block braces is inside an arrow function without braces handled incorrently during an outer function lazy instantiation.
The inner arrow function treated the most outer simple function as its parent instead of the outer arrow function due to the invalid use of config.parseSingleFunction.
Also the 0 parseFunctionIndex must be valid for arrow functions as well during the lazy instantiation.
This patch fixes#343.
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
* Make to run chakracore, v8, jsc-stress test parallelly
* Make to call backtrace() faster on test262. this improves running speed of debug binary.
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
* CreateRestElement bytecode is newly added for generating a rest parameter
* RestElementNode is added to handle patterns in rest parameter later
* rest parameter is created at the first part of the function body execution
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* 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>
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>
* implement mapped/unmapped ArgumentsObject
* passed arguments-related test262 TCs
* ArgumentsObject initially stores its matched values in an inner array (fast mode)
* when a property descriptor changed, ArgumentsObject manages the arg value as its property (slow mode)
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
* 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>
* 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>
There can be cases when the object properties are removed in their
setter functions. This patch fixes#289.
Signed-off-by: Roland Takacs <rtakacs.uszeged@partner.samsung.com>
* ScanExpresionResult stores additional AtomicString info to sync with esprima code more intuitively
* scanner for groupExpression module is updated
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
- Introduce INIT_STATIC_STRING macro to make adding new static string much easier.
- Introduce AtomicString::initStaticString to append static string to the static string set directly
without lookup for an already existing name.
- Add a number list and remove the dtoa function call for the initialization of string numbers.
- Split the single character initialization to ASCII and Latin1 string part.
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
* native constructor function ptr in CallNativeFunctionData is removed
* builtin function call process is divided from normal call process
* Date constructor is fixed according to ES6 spec
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
- 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>
- Limit the size of the concatenated string
- Skip the concatenation of empty strings
This patch allows to enable mjsunit/es6/string-repeat.js
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
There is no need to keep the template literal of TemplateOperation since
it always set to NULL. Currently, a LoadLiteral opcode is created for the
template literals.
Signed-off-by: Roland Takacs <rtakacs.uszeged@partner.samsung.com>
* 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
1109 changed files with 404875 additions and 47145 deletions
Escargot is a lightweight JavaScript engine developed by [Samsung](https://github.com/Samsung), designed specifically for resource-constrained environments. It is optimized for performance and low memory usage, making it ideal for use in embedded systems, IoT devices, and other applications where resources are limited.
Key features of Escargot include:
* **ECMAScript Compliance**: Escargot supports a significant portion of the latest ECMAScript version ([ECMAScript 2025](https://262.ecma-international.org/16.0/)), ensuring compatibility with modern JavaScript standards while maintaining a lightweight footprint.
* **Memory Efficiency**: The engine is designed with memory constraints in mind, making it suitable for devices with limited RAM and storage.
* **Performance Optimization**: Escargot implements various optimization techniques to ensure fast execution of JavaScript code, even on low-power devices.
* **Extensibility**: The engine can be customized and extended to meet the specific needs of different applications, providing flexibility for developers.
Escargot is an open-source project that allows developers to contribute to its development or use it in their own projects, while also powering several services in Samsung products. The engine's design prioritizes simplicity and efficiency, making it an excellent choice for developers working in embedded or resource-limited environments.
## Contents 📋
* [Building](#Building-)
* [Linux](#Linux)
* [macOS](#macOS)
* [Android](#Android)
* [Windows](#Windows)
* [Testing](#Testing-)
* [Contributing](#Contributing-)
* [Research Papers](#Research-Papers-)
* [License](#License-)
## Building 🛠️
### Supported Platforms and Architectures
| **OS** | **Architecture** |
|-|-|
| **Linux(Ubuntu)** | x86/x64/arm/aarch64 |
| macOS | x64/aarch64 |
| Windows | Win32/x64 |
| Android | x86/x64/arm/aarch64 |
### Build Options
The following build options are supported when generating build rules using cmake.
Make sure Escargot is built with the `-DESCARGOT_DEBUGGER=1` flag (off by default) enabled;
then start Escargot with the `--start-debug-server` option.
### Connect using a debugger client
- Escargot python debugger
- run `./tools/debugger/debugger.py`; It will automatically connect to a debug server on the default port `6501`
- run `./tools/debugger/debugger.py --help` for a list of options
- [Visual Studio Code extension](https://github.com/Samsung/escargot-vscode-extension/?tab=readme-ov-file#how-to-use)
- Chrome Devtools `⚠️ Early in development ⚠️`
- Initial setup:
- Navigate to [chrome://inspect](chrome://inspect)
- Make sure *Discover network targets* is enabled; click configure
- Add `localhost:6501` as a target; click Done
- Usage:
- The started debug server will be listed in the *Remote Target* list (If it is not, the page may need to be reloaded using the browser reload button)
- Click `inspect`
- A new window with the Chrome Devtools debugger UI will open
## Testing ✅
Escargot supports various benchmark sets, which can be run using the [tools/run-tests.py](https://github.com/Samsung/escargot/blob/master/tools/run-tests.py) script.
Escargot welcomes contributions from developers in any form, wheter it's code, documentation, bug reports, or suggestions. By contributing to the project, you agree to license your contributions under the [LGPL-2.1](https://github.com/Samsung/escargot/blob/master/LICENSE) license.
#### ❗ Vulnerability Reporting
⚠️ If you identify any vulnerabilities, please report them through the [Issues page](https://github.com/Samsung/escargot/issues). *Reports sent via other channels may not be considered or may be processed with delays*. Please note that our project assumes the execution of valid JavaScript source code only. Handling of invalid source code is not within the main scope of this project and might not be addressed.
## Research Papers 📝
* [Dynamic code compression for JavaScript engine](https://doi.org/10.1002/spe.3186)
Software: Practice and Experience Vol. 53 (5), pp. 1196-1217, 2023
* [Tail Call Optimization Tailored for Native Stack Utilization in JavaScript Runtimes](https://doi.org/10.1109/ACCESS.2024.3441750)
IEEE Access Vol. 12, pp. 111801-111817, 2024
## License 📜
Escargot is open-source software primarily licensed under [LGPL-2.1](https://github.com/Samsung/escargot/blob/master/LICENSE), with some components covered by other licenses. Complete license and copyright information can be found in the source code.