Compare commits

..

1,895 commits

Author SHA1 Message Date
Seonghyun Kim
bab3a57975 Fix RELEASE_ASSERT_NOT_REACHED on CoverInitializedName used as a value
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>
2026-06-18 19:02:02 +09:00
Seonghyun Kim
181019c0c3 Reject object binding pattern rest followed by a binding pattern (Issue #1334)
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>
2026-06-18 16:09:00 +09:00
Seonghyun Kim
c37e2b4851 A class definition is always strict mode
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-06-18 10:05:18 +09:00
Seonghyun Kim
2dee22f5c7 Update test/vendortest with Issue #1577 regression tests
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-06-17 10:06:57 +09:00
Seonghyun Kim
5e3b91b052 Fix using declaration in a switch case clobbering its disposable record (Issue #1577 Crash #2)
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>
2026-06-17 10:06:57 +09:00
Seonghyun Kim
e7221f4211 Fix labeled continue targeting a for-of loop (Issue #1577 Crash #1)
`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>
2026-06-17 10:06:57 +09:00
Seonghyun Kim
b30b63fc63 Fix continue/break at first instruction of env-allocating block (Issue #1571)
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>
2026-06-16 15:35:01 +09:00
Seonghyun Kim
60b1202a72 Fix labeled continue regression in test262 tests
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>
2026-06-16 15:35:01 +09:00
Seonghyun Kim
0a2fcaaf5e Add missing m_currentLoopLabel field and fix Crashes #1-2
- Add m_currentLoopLabel to ByteCodeGenerateContext for tracking labeled loop labels (Issue #1571)
- Fix Crash #1: Add bounds checking in inline cache proto traverse with std::min clamping
- Fix Crash #2: Check hasBinding before initializeBinding to prevent assertion on unreachable code paths

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-06-16 15:35:01 +09:00
Seonghyun Kim
09f0a10bba Fix DoWhileStatementNode labeled continue handling (Issue #1571)
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>
2026-06-16 15:35:01 +09:00
Seonghyun Kim
7e2b3292fd Fix WhileStatementNode labeled continue handling (Issue #1571)
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>
2026-06-16 15:35:01 +09:00
Seonghyun Kim
8fd141b29c Fix ForInOfStatementNode labeled continue handling (Issues #1571 Crashes #3-4)
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>
2026-06-16 15:35:01 +09:00
Seonghyun Kim
c80623fc00 Fix ForStatementNode labeled continue handling (Issues #1571 Crashes #3-13)
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>
2026-06-16 15:35:01 +09:00
Seonghyun Kim
92ee65bc0c Update LabelledStatementNode to pass label to child loop
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-06-16 15:35:01 +09:00
Seonghyun Kim
07cdae7850 Update test cases
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-06-16 15:35:01 +09:00
Seonghyun Kim
ef525f337f Add programCount range check for edge case in blockOperation
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-06-15 11:50:30 +09:00
Ádám László Kulcsár
29fdbc741f Improve eval in devtools
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>
2026-06-10 10:48:28 +09:00
Máté Tokodi
ebe3761308 Add support for scope variables and call stack in the Devtools Debugger
Signed-off-by: Máté Tokodi <mate.tokodi@szteszoftver.hu>
2026-06-10 10:44:10 +09:00
Ádám László Kulcsár
c423a4bfa0 Implement eval in Devtools debugger
Signed-off-by: Ádám László Kulcsár <adam.kulcsar@szteszoftver.hu>
2026-06-01 23:56:51 +09:00
epsilon
4b40f92aba Fix OOB read in string::rfind 2026-05-27 19:21:59 +09:00
Seonghyun Kim
779f6bedf5 Check stack overflow in ProxyObject::getPrototype, ProxyObject::getPrototypeObject
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-05-27 11:31:45 +09:00
Seonghyun Kim
d581b27af6 Check overflow when TypedArrayObject allocating for 32-bit systems
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-05-27 11:31:45 +09:00
Seonghyun Kim
3b43994a7d Don't assume spread element is fast mode
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-05-27 11:31:45 +09:00
Seonghyun Kim
299a7ff451 Fix crash in ArrayBuffer transfer
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-05-27 11:31:45 +09:00
Seonghyun Kim
36f5fb5836 Add size checking on ArrayBuffer.prototype.transfer
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-05-21 16:15:10 +09:00
Ádám László Kulcsár
d6aae0777f Fix bug with Devtools filenames
Fix bug where filenames could contain memory garbage.

Signed-off-by: Ádám László Kulcsár <adam.kulcsar@szteszoftver.hu>
2026-05-14 19:57:40 +09:00
Seonghyun Kim
590345cc62 Update vendor test
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-05-14 13:33:33 +09:00
Seonghyun Kim
c02c6595be Handle oom explicitly
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-05-14 13:33:33 +09:00
Seonghyun Kim
166fa7c66b Disable GC on c++ catch block w/ASAN
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-05-14 13:33:33 +09:00
Seonghyun Kim
3cf7d60b43 Fix memory error when FinalizationRegistry cleanup callback throws
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-05-14 13:33:33 +09:00
Seonghyun Kim
2bbd27caac Add stack overflow check in ProxyObject::ownPropertyKeys
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-05-14 13:33:33 +09:00
Seonghyun Kim
78e5e333b9 Compute ByteCodeLOC only !NDEBUG && ESCARGOT_DEBUGGER in ByteCodeBlock::pushCode
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-05-14 13:33:33 +09:00
Seonghyun Kim
22bedcec9e In Evaluator::EvaluatorResult::resultOrErrorToString error can be null even if the task was successful
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-05-14 13:33:33 +09:00
Seonghyun Kim
aa727d22a1 Use PointerFree allocatior for FunctionContextVarMap
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-05-14 13:33:33 +09:00
Seonghyun Kim
121d2fefca Fix StringObject::defineOwnProperty
* Check if this is an index property within the string length due to proxy object

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-05-14 13:33:33 +09:00
Seonghyun Kim
2e9a6393b9 In InterpreterSlowPath::arrayDefineOwnPropertyBySpreadElementOperation,
setArrayLength can convert the array to non-fast mode when length exceeds thresholds

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-05-14 13:33:33 +09:00
Seonghyun Kim
685a71c3d1 Check if the size exceeds the maximum allowed size for TypedArray construction
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-05-14 13:33:33 +09:00
Seonghyun Kim
78576a5af9 Update vendor test
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-05-14 13:33:33 +09:00
Seonghyun Kim
c8588c323c prevent stack overflow when parsing huge json array
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-05-14 13:33:33 +09:00
Seonghyun Kim
2cc649c97e Use correct index in DataViewObject::setViewValue
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-05-14 13:33:33 +09:00
Seonghyun Kim
98f54274d1 Fix buffer access bug in builtinTypedArrayCopyWithin
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-05-14 13:33:33 +09:00
SAY-5
0a79d6c1f7 Fix out-of-bounds read in lexer comment/hashbang skipping
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>
2026-05-12 15:57:50 +09:00
Ádám László Kulcsár
634fe864d7 Add -Wno-maybe-uninitialized build option for GCC 16
Signed-off-by: Ádám László Kulcsár <adam.kulcsar@szteszoftver.hu>
2026-05-11 20:40:32 +09:00
Ádám László Kulcsár
475149426f Implement escargot debugger restart support
Implement restart in escargot and python debugger.
Also add debugger test.

Signed-off-by: Ádám László Kulcsár <adam.kulcsar@szteszoftver.hu>
2026-05-07 16:12:31 +09:00
Ádám László Kulcsár
7683468efb Add heap snapshots to devtools debugger
Signed-off-by: Ádám László Kulcsár <adam.kulcsar@szteszoftver.hu>
2026-04-29 09:37:05 +09:00
Máté Tokodi
48eb4b6af9 Add support for breakpoints in the Devtools Debugger
- Add, remove breakpoints
- Resume execution
- Step Into, Step Out, Step Over
- Deactivate/Reactivate all breakpoints

Signed-off-by: Máté Tokodi <mate.tokodi@szteszoftver.hu>
2026-04-28 16:43:39 +09:00
Ádám László Kulcsár
e9833cd791 Rework python debugger tester
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>
2026-04-28 16:42:06 +09:00
Ádám László Kulcsár
769e86e32a Add ability to take heap snapshots with python debugger
Signed-off-by: Ádám László Kulcsár <adam.kulcsar@szteszoftver.hu>
2026-04-23 11:35:55 +09:00
Seonghyun Kim
ad3844437e Update ArrayBuffer::isDetachedBuffer check
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-04-23 11:35:23 +09:00
Ádám László Kulcsár
633fe63795 Add funcitonality to take heap snapshots
Signed-off-by: Ádám László Kulcsár <kuladam@inf.u-szeged.hu>
2026-04-16 15:42:23 +09:00
Seonghyun Kim
e52f0ce0cf Fix read private property on inner object method
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-04-16 09:25:12 +09:00
Seonghyun Kim
2624608567 Update clang compile option for old clang
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-04-16 09:25:12 +09:00
Ádám László Kulcsár
0ac274d1fc Add correct debugging to .mjs files
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>
2026-04-14 21:35:29 +09:00
Máté Tokodi
ab7a13e089 Fix Devtools debugger websocket buffer handling
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>
2026-04-09 12:27:01 +09:00
Seonghyun Kim
f25f05faca Validate input on CodeCacheReader
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-04-08 10:00:03 +09:00
Seonghyun Kim
a7f9695bf3 Check buffer size before reading buffer on CodeCacheReader
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-04-08 10:00:03 +09:00
Seonghyun Kim
50215a5ce8 Check wrong input in Serializer::deserializeFrom
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-04-08 10:00:03 +09:00
Seonghyun Kim
13e3a62312 Disable 32-bit pointer using with asan since it makes bdwgc related error
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-04-08 10:00:03 +09:00
Seonghyun Kim
2156cfa5b8 Fix compiler issue with int128(gcc-10 upper)
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-04-08 10:00:03 +09:00
Seonghyun Kim
b4f2b24e4a Fix compile error on clang-20
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-04-08 10:00:03 +09:00
Máté Tokodi
97e8115ab1 Add basics of Chrome Devtools debugger support
- 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>
2026-03-28 13:08:51 +09:00
Hyukwoo Park
989e6922b6 Remove duplicated parameter-check methods
Signed-off-by: Hyukwoo Park <hyukwoo.park@jbnu.ac.kr>
2026-03-13 13:27:59 +09:00
Seonghyun Kim
6ebbd22c06 Optimize very big object expression through big bloom filter
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-03-10 16:01:03 +09:00
Seonghyun Kim
069fba1151 Optimize big object expression through bloom filter
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-03-10 16:01:03 +09:00
Máté Tokodi
9819a8de49 Debugger: add dedicated message for VSCode watch
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
2026-03-09 08:19:57 +09:00
kwonjeomsim
f41ec3426b Change bottom-up to top-down check 2026-03-09 08:19:04 +09:00
kwonjeomsim
1b36b95006 Change location of optimization logic 2026-03-09 08:19:04 +09:00
kwonjeomsim
c69b8ada67 Add codes checking assignment pattern and rest parameter usage 2026-03-09 08:19:04 +09:00
kwonjeomsim
f6e0b04be4 Change location of removing unused parameters 2026-03-09 08:19:04 +09:00
kwonjeomsim
4d4cded5be Change AtomicStringMap allocation and deal with parameters over 16 2026-03-09 08:19:04 +09:00
kwonjeomsim
5c16ae5d84 Change m_parameterUsed to bit operation and Add hashset 2026-03-09 08:19:04 +09:00
kwonjeomsim
12a37ed4d1 Change unused parameter check point 2026-03-09 08:19:04 +09:00
kwonjeomsim
fb8b241655 Add InterpretedCodeBlock::ParameterUsed info to codecache 2026-03-09 08:19:04 +09:00
kwonjeomsim
339a5d1838 Add parsing process that remove unused function parameter bytecodes 2026-03-09 08:19:04 +09:00
Seonghyun Kim
bb00312798 Update gbs.conf to fix build error on ci
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-03-06 13:05:41 +09:00
Seonghyun Kim
c9f13d0730 Fix compile error on old gcc
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-03-05 17:20:30 +09:00
Seonghyun Kim
e35a8cb14d Add enconding option for python code generator
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-03-05 17:20:30 +09:00
Seonghyun Kim
af4c67a706 Implement VMInstanceRef::enqueueEvaluateJob
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-02-12 14:35:37 +09:00
Seonghyun Kim
c90e358e2f Generate YarrCanonicalizeUCS2.cpp from UnicodeData.txt
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-02-11 09:53:27 +09:00
Seonghyun Kim
17bdb07cc6 Update es-actions for clang
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-02-10 14:53:17 +09:00
Hyukwoo Park
eeea83ef3e Enable self-hosted runners only for the origin escargot repo
Signed-off-by: Hyukwoo Park <hyukwoo.park@jbnu.ac.kr>
2026-02-07 20:00:39 +09:00
Seonghyun Kim
d50bb8897a Update analysis-actions.yml
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-02-05 16:56:44 +09:00
Seonghyun Kim
a3abf7e40a Revise source generate from unicode data logic
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-02-05 16:56:44 +09:00
Seonghyun Kim
32281e3d22 Update processMemoryUsage function for posix
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-02-05 16:56:44 +09:00
Seonghyun Kim
ea826db76a Add thread memory usage test case
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-02-04 17:21:25 +09:00
Seonghyun Kim
7bd328b5df When thread exit, we should unmap mapped memory which is mapped from bdwgc
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-02-04 17:21:25 +09:00
Seonghyun Kim
20c7641b16 Implement tizen gbs build test on CI
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-02-03 12:48:04 +09:00
Seonghyun Kim
e44005a1d2 Android timezone data load for adb-shell
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-01-30 17:34:13 +09:00
Seonghyun Kim
a130b108a5 Implement Global::finalizeGC to prevent memory leak
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-01-30 09:54:22 +09:00
Máté Tokodi
fb2ad1eb04 Fix exporting async functions in ESM modules
Add mjs file matching to regression test script
2026-01-28 13:48:08 +09:00
Seonghyun Kim
32e9a72156 Fix typo in Intl::initNumberFormatSkeleton
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-01-27 12:57:45 +09:00
Seonghyun Kim
2a3447dc1c Add missing package for tizen build
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-01-08 19:25:39 +09:00
Seonghyun Kim
3b242a2e6e Update coverage-scan
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-01-07 12:20:48 +09:00
Seonghyun Kim
95036c339e Evaluate destructuring correctly
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-01-07 12:20:48 +09:00
Seonghyun Kim
50f1d7a2f1 When closing the iterator, handle exceptions that occur when retrieving the return function correctly.
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-01-07 12:20:48 +09:00
Seonghyun Kim
3f07b5696c Update TypedArray.prototype.toLocaleString to pass argv
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-01-06 16:17:04 +09:00
Seonghyun Kim
a138441b98 Use new Calendar functions in Intl + Fix timezone bug in Intl.DateTimeFormat
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-01-06 16:17:04 +09:00
Seonghyun Kim
a474595528 Update test262 driver
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-01-06 16:17:04 +09:00
Seonghyun Kim
75394413ac Fix ShadowRealm.prototype.importValue memory error
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-01-06 16:17:04 +09:00
Seonghyun Kim
1ab58f5470 Revise DecodeURI function to test max unicode codepoint
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-01-06 16:17:04 +09:00
Seonghyun Kim
a622791f6e Apply updated rules of TypedArray.[[Set]]
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-01-05 10:44:02 +09:00
Seonghyun Kim
142cf01ad4 In TypedArrayObject::integerIndexedElementSet check detached buffer correctly
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-01-05 10:44:02 +09:00
Seonghyun Kim
c231374c38 Update TypedArray.prototype.copyWithin to respect new ECMAScript spec
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2026-01-05 10:44:02 +09:00
Seonghyun Kim
ec0d3f1c61 Implement ShadowRealm.prototype.importValue
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-31 10:22:29 +09:00
Seonghyun Kim
982f15c83d Revise ShadowRealm
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-31 10:22:29 +09:00
Seonghyun Kim
23b88e0d3d When matchAll, 'v' is also unicode flag
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-31 10:22:29 +09:00
Seonghyun Kim
94abd9142c Apply updated spec of RegExp prototype functions
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-31 10:22:29 +09:00
Seonghyun Kim
bf4d55e27a Don't use error value on closeing iterator in Promise builtins
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-31 10:22:29 +09:00
Seonghyun Kim
f5ae276846 Disallow -0 year on DateObject parsing
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-31 10:22:29 +09:00
Seonghyun Kim
ef4b1ef414 Implement Iterator.concat method
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-30 14:53:22 +09:00
Seonghyun Kim
5537c312dc Replement DateView constructor to respect new ECMAScript spec
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-26 16:06:16 +09:00
Seonghyun Kim
b66f1f6678 Reject promise with broken promise in AsyncGenerator.prototype.return
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-26 16:06:16 +09:00
Seonghyun Kim
d49aece60c Fixup Date.prototype.setYear
* Read [[DateValue]] and then call ToNumber when stored time-value is valid

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-26 16:06:16 +09:00
Seonghyun Kim
be331e04c3 Use correct Realm on ScriptClassConstructorFunctionObjectReturnValueBinderWithConstruct
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-26 16:06:16 +09:00
Seonghyun Kim
c7a1b4154b Fixup resizable and detached check in ArrayBuffer
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-26 16:06:16 +09:00
Seonghyun Kim
e74404b9a2 Use tryToUseAsIndex in Array.prototype.join
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-24 09:37:03 +09:00
Seonghyun Kim
8aae441360 Update testing files
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-24 09:37:03 +09:00
Seonghyun Kim
c54390bf2e Generate unicode related files from raw unicode text file
* 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>
2025-12-24 09:37:03 +09:00
Seonghyun Kim
c599abdc60 Runs coverage tests on self-hosted runner
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-18 18:53:40 +09:00
Seonghyun Kim
8f24498310 Fix minor Temporal issues
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-18 18:03:08 +09:00
Seonghyun Kim
7bb1e520a5 Fix issues on Temporal::calendarResolveFields
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-18 18:03:08 +09:00
Seonghyun Kim
82924e7db5 Fix comptued eraYear check bug
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-18 18:03:08 +09:00
Seonghyun Kim
f541c5c63f Implement Temporal ISODateToFields method
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-18 18:03:08 +09:00
Seonghyun Kim
2f42f070f3 islamic and islamic-rgsa is not supported calendar for Temporal
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-16 16:45:19 +09:00
Seonghyun Kim
5c64d63fd1 Implement missing part of TemporalObjects.prototype.toLocaleString
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-16 16:45:19 +09:00
Seonghyun Kim
2b7a5657ef Extend time limit of analysis-action
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-16 16:45:19 +09:00
Seonghyun Kim
345a295cba Update indian era code for icu-78
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-16 16:45:19 +09:00
Seonghyun Kim
ce0d795280 Update Calendar::diffYearDueToICU4CAndSpecDiffer for icu-78
* see https://unicode-org.atlassian.net/browse/ICU-23167

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-16 16:45:19 +09:00
Seonghyun Kim
4e589b1a52 Use key of era data correctly for icu-78
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-16 16:45:19 +09:00
Seonghyun Kim
15d86aeeb9 Update test set to icu-78 and ubuntu24.04
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-15 18:43:33 +09:00
Seonghyun Kim
71706514f4 Fix extended year bug with iso8601 calendar
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-15 18:43:33 +09:00
Seonghyun Kim
ee64383623 Update Temporal methods
* Update Temporal::calendarDateUntil for non-iso 8601 calendars
* Update monthCode, monthsInYear logic for chinese, dangi calendar

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-15 18:43:33 +09:00
Seonghyun Kim
e6417b8ed8 Update Temporal
* 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>
2025-12-15 18:43:33 +09:00
Seonghyun Kim
7667784d79 Consider single era correctly in Temporal
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-15 18:43:33 +09:00
Seonghyun Kim
b1dd07f05c Show correct era code and eraYear to islamic calendars
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-15 18:43:33 +09:00
Seonghyun Kim
2325f6fc64 Improve Temporal + intl402
* Update test262
* Apply basic of https://tc39.es/proposal-intl-era-monthcode/

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-15 18:43:33 +09:00
Seonghyun Kim
1175bb303b Implement Array.fromAsync
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-03 13:54:50 +09:00
Seonghyun Kim
d06a31a1a2 Update Intl.DateTimeFormat.formatRange, formatRangeToParts for Temporal
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-02 13:41:54 +09:00
Seonghyun Kim
369278e640 Implement overwrapping options of Temporal...toLocaleString
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-02 13:41:54 +09:00
Seonghyun Kim
7dd0c1821e Implement Temporal.Duration.prototype.toLocaleString
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-02 13:41:54 +09:00
Seonghyun Kim
33d32009da Implement Temporal.{PlainTime, PlainDateTime}.prototype.toLocaleString
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-02 13:41:54 +09:00
Seonghyun Kim
c3841a7176 Implement Temporal.{PlainYearMonth, PlainMonthDay}.prototype.toLocaleString
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-02 13:41:54 +09:00
Seonghyun Kim
0a2eec0e85 Skip Temporal test on arm32-linux
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-02 13:41:54 +09:00
Seonghyun Kim
75cdb470ba Implement Temporal.Instant.prototype.toLocaleString
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-02 13:41:54 +09:00
Seonghyun Kim
45313ea2ce Implement Temporal.ZonedDateTime.prototype.toLocaleString
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-02 13:41:54 +09:00
Seonghyun Kim
66e105e9f8 Treat timezones correctly
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-12-02 13:41:54 +09:00
Seonghyun Kim
4a4f8a6d7e Call GC_gcollect_and_unmap and GC_invoke_finalizers on Global::finalize
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-11-20 17:26:47 +09:00
Seonghyun Kim
ef5ef0b9b4 Update GCutil
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-11-20 14:25:16 +09:00
Seonghyun Kim
18d3f010a0 Date.prototype.toTemporalInstant
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-11-20 14:25:16 +09:00
Seonghyun Kim
297162133e Implement Temporal.Duration.compare
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-11-20 14:25:16 +09:00
Seonghyun Kim
ba05eaec99 Implement Temporal.Duration.total, round
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-11-20 14:25:16 +09:00
Seonghyun Kim
5bbfa73dcd Implement Temporal.Instant.toZonedDateTimeISO
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-11-20 14:25:16 +09:00
Seonghyun Kim
5240b9cbec Implement Temporal.Now.*ISO() functions
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-11-20 14:25:16 +09:00
Ivan Maidanski
72172f6c47 Update LICENSE.BOEHM-GC
The license file is copied from third_party/GCutil/LICENSE.

Signed-off-by: Ivan Maidanski <ivmai@mail.ru>
2025-11-20 10:40:24 +09:00
Ivan Maidanski
d017677d54 Change build scripts after move bdwgc files to gcutil repository root
Change `GCutil/bdwgc` to `GCutil` in escargot.spec, android CMakeLists.txt.
Remove `-I .../GCutil/bdwgc -I .../GCutil/bdwgc/include/gc`.

Signed-off-by:  Ivan Maidanski <ivmai@mail.ru>
2025-11-19 16:06:58 +09:00
Seonghyun Kim
98de57bc8a Fix windows CI
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-11-18 17:58:10 +09:00
Seonghyun Kim
fdac7ae1c3 Implement Temporal.ZonedDateTime.round, startOfDay, getTimeZoneTransition, valueOf, compare
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-11-17 11:17:29 +09:00
Seonghyun Kim
dccf2f9256 Implement Temporal.ZonedDateTime.since, until
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-11-17 11:17:29 +09:00
Seonghyun Kim
83c9e9a50a Implement Temporal.ZonedDateTime.add, subtract
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-11-17 11:17:29 +09:00
Seonghyun Kim
0c41944316 Implement Temporal.ZonedDateTime.with* functions
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-11-17 11:17:29 +09:00
Seonghyun Kim
3844dced3f Support more timezone names on Temporal
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-11-17 11:17:29 +09:00
Seonghyun Kim
0249b5efb5 Implement Temporal.ZonedDateTime.to* functions
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-11-17 11:17:29 +09:00
Seonghyun Kim
1c3248ce35 Implement Temporal.PlainDateTime.toZonedDateTime
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-11-17 11:17:29 +09:00
Seonghyun Kim
ef617652dc Implement Temporal.PlainDate.to* functions
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-11-17 11:17:29 +09:00
Seonghyun Kim
bb3c62e2cc Implement from, toString, equals, getter of Temporal.ZonedDateTimeObject
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-11-10 13:20:35 +09:00
Seonghyun Kim
acd242f7df Implement constructor of Temporal.ZonedDateTimeObject
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-11-10 13:20:35 +09:00
Seonghyun Kim
5618ae6f7b Implement Temporal.PlainDateTime.compare
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-10-21 15:10:15 +09:00
Seonghyun Kim
dc7640a152 Implement Temporal.PlainDateTime.{ toPlainTime, toPlainDate }
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-10-21 15:10:15 +09:00
Seonghyun Kim
5e5eb5d631 Implement Temporal.PlainDateTime.{ equals, round }
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-10-21 15:10:15 +09:00
Seonghyun Kim
fa3432f1d6 Implement Temporal.PlainDateTime.{ since, until }
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-10-21 15:10:15 +09:00
Seonghyun Kim
9d634be004 Implement Temporal.PlainDateTime.{ add, subtract }
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-10-21 15:10:15 +09:00
Seonghyun Kim
cb01142c4c Implement Temporal.PlainDateTime.{ with * }
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-10-21 15:10:15 +09:00
Seonghyun Kim
f9ca29d5cb Implement basic of Temporal.PlainDateTime
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-10-17 14:58:40 +09:00
Seonghyun Kim
c3c3bca85e Implement basic of Temporal.PlainMonthDay
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-10-17 14:58:40 +09:00
Seonghyun Kim
600fa1a906 Implement Temporal.PlainYearMonth.{ until, since }
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-10-14 14:21:15 +09:00
Seonghyun Kim
b9041e60b7 Implmenet Temporal.PlainYearMonth.{ add, subtract }
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-10-14 14:21:15 +09:00
Seonghyun Kim
70e0721082 Implement Temporal.PlainYearMonth.{ compare, with, toPlainDate }
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-10-14 14:21:15 +09:00
Seonghyun Kim
36e4562e68 Fix minor issues in PlainYearMonth
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-10-14 14:21:15 +09:00
2jaeheon
77a3b8554f ci(macos): add ad-hoc codesign for .dylib artifacts
Signed-off-by: 2jaeheon <jaeheon0826@jbnu.ac.kr>
Co-authored-by: M-SE0K <seg082911@gmail.com>
2025-10-02 13:10:02 +09:00
2Jaeheon
77741e8d13 ci: fix-windows build
Signed-off-by: 2Jaeheon <jaeheon0826@jbnu.ac.kr>
2025-09-26 16:06:22 +09:00
Hyukwoo Park
4f0a1cff00 Fix conflicts in actions
Signed-off-by: Hyukwoo Park <hyukwoo.park@jbnu.ac.kr>
2025-09-26 09:10:37 +09:00
2Jaeheon
9e414f3933 ci: add -DCMAKE_POLICY_VERSION_MINIMUM to builds
Signed-off-by: 2Jaeheon <jaeheon0826@jbnu.ac.kr>
2025-09-24 17:30:15 +09:00
Seonghyun Kim
641e3813c4 Implement basic of Temporal.PlainYearMonth
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-09-22 16:48:25 +09:00
Hyukwoo Park
8b39a2c3ff Enable workflow_dispatch in release action
Signed-off-by: Hyukwoo Park <hyukwoo.park@jbnu.ac.kr>
2025-09-20 18:35:42 +09:00
Seonghyun Kim
8e5636c198 Implement Temporal.PlainDate.{ since, until }
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-09-18 16:17:04 +09:00
Seonghyun Kim
5b74588aa1 Implement Temporal.PlainDate.{ add, subtract, equals, with, withCalendar }
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-09-18 16:17:04 +09:00
Seonghyun Kim
141797871f Implement basic of Temporal.PlainDate
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-09-18 16:17:04 +09:00
Seonghyun Kim
90d8da7fe8 Implement Temporal.PlainTime.{ since, until, round, equals }
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-09-18 16:17:04 +09:00
Seonghyun Kim
d7c2db8f3f Implement Temporal.PlainTime.{ toString, add, subtract, from }
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-09-18 16:17:04 +09:00
Seonghyun Kim
84a305785a Implement base of Temporal.PlainTime
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-09-18 16:17:04 +09:00
2Jaeheon
293729c869 implement: code review bot
Signed-off-by: 2Jaeheon <jaeheon0826@jbnu.ac.kr>
2025-09-18 16:15:47 +09:00
Hyukwoo Park
40e54ebead Fix cmake build error in macOS-actions
Signed-off-by: Hyukwoo Park <hyukwoo.park@jbnu.ac.kr>
2025-09-15 12:15:03 +09:00
Seonghyun Kim
8d140c3c0f Implement Temporal.Duration.{ add, subtract, with, toLocalString, toJSON }
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-09-09 11:38:59 +09:00
Seonghyun Kim
7135cbaefe Implement Temporal.Instant.{add, subtract, compare}
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-09-09 11:38:59 +09:00
Seonghyun Kim
34c2f0a20e Implement Temporal.Instant.{since, until}, Temporal.duration.{toString, negated}
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-09-09 11:38:59 +09:00
Seonghyun Kim
5711241b99 Implement Temporal.Instant.{ toLocalString, toJSON, round }
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-09-04 13:22:13 +09:00
Seonghyun Kim
96beab3416 Implement basic methods of Temporal.Instant
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-09-04 13:22:13 +09:00
Seonghyun Kim
06e356f15a Introduce Int128 library
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-09-04 13:22:13 +09:00
Seonghyun Kim
6175024ffc Implement basic of Temporal.Duration
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-09-04 13:22:13 +09:00
Seonghyun Kim
3c1ddaaa50 Implement basic of Temporal.Now and Temporal.Instant
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-09-04 13:22:13 +09:00
Seonghyun Kim
52bbc7a9bc Update README and CMakeFiles
* rename ESCARGOT_ENABLE_SHADOWREALM to ESCARGOT_SHADOWREALM in build stuff

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-26 17:00:40 +09:00
Seonghyun Kim
fc47134b6e Rename ESCARGOT_ENABLE_SHADOWREALM to ENABLE_SHADOWREALM in source code
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-25 12:38:24 +09:00
kwonjeomsim
2482f40fe2 Implement ShadowRealm Wrapped function 2025-08-22 14:21:26 +09:00
kwonjeomsim
25a5bf17c3 Implement ShadowRealm constructor and prototype.evaluate method 2025-08-22 14:21:26 +09:00
Seonghyun Kim
6cfdea8169 Update release.yml
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-22 14:21:01 +09:00
Patrick Kim
1577634b8f
Update README.md 2025-08-21 17:24:56 +09:00
Seonghyun Kim
7993469edf Bump version to 4.3.0
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-21 17:22:59 +09:00
Seonghyun Kim
d8e2610f90 Implement using vairable with for-of statement
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-21 17:22:15 +09:00
Seonghyun Kim
39b990ed7a Implement AsyncDisposableStack
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-21 17:22:15 +09:00
Seonghyun Kim
c3fadf767b Implement %IteratorPrototype% [ @@dispose ] and %AsyncIteratorPrototype% [ @@asyncDispose ]
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-21 17:22:15 +09:00
Seonghyun Kim
fff09af8c3 Implement basic of await using statement
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-21 17:22:15 +09:00
Seonghyun Kim
4a372c5b01 Implement DisposableStackObject
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-21 17:22:15 +09:00
Seonghyun Kim
26a2d9d39c Fix using statement bugs
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-21 17:22:15 +09:00
Seonghyun Kim
98c145bdff Fix parser error while parse using variable
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-21 17:22:15 +09:00
Seonghyun Kim
954b5bc77f Implement basic of using variable
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-21 17:22:15 +09:00
Seonghyun Kim
b2ba17408c Implement SuppressedError
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-21 17:22:15 +09:00
Seonghyun Kim
b50bda684b Update windows SDK version
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-21 17:22:15 +09:00
HyukWoo Park
1e11e1d668 Support SharedArrayBuffer in WASM Memory
Signed-off-by: HyukWoo Park <hyukwoo.park@jbnu.ac.kr>
2025-08-13 11:23:15 +09:00
HyukWoo Park
a11e806c20 Update walrus module
Signed-off-by: HyukWoo Park <hyukwoo.park@jbnu.ac.kr>
2025-08-13 11:23:15 +09:00
Seonghyun Kim
152bd60e3a Fix compile error & disable outdated tests
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-13 11:22:55 +09:00
Seonghyun Kim
108b0a2d87 Implement Uint8Array.fromHex, Uint8Array.prototype.{ toHex, setFromHex }
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-13 11:22:55 +09:00
Seonghyun Kim
e8b7538e24 Implement Uint8Array.prototype.{setFromBase64, toBase64} and Uint8Array.fromBase64
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-13 11:22:55 +09:00
Seonghyun Kim
c31d8d6fdb Add GC disable, enable api to public header
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-11 12:56:36 +09:00
Seonghyun Kim
c543b17857 Revise TypedArray builtins for support resizble ArrayBuffer correctly
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-11 12:56:36 +09:00
Seonghyun Kim
b1e87e6801 Implement Iterator.from method
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-11 12:56:36 +09:00
Seonghyun Kim
989e924b49 RelativeTimeFormat should have own NumberFormat
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-07 11:42:40 +09:00
Seonghyun Kim
a526fc2ad8 Implement Intl.Segmenter.prototype.segment method
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-07 11:42:40 +09:00
Seonghyun Kim
39be7b7d97 Implement Intl.Segmenter constructor
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-07 11:42:40 +09:00
Seonghyun Kim
e5fe9d44c6 Move many Normal StaticStrings into Intl lazy StaticStrings
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-07 11:42:40 +09:00
Seonghyun Kim
a058a43145 Implement new methods of Intl.Locale
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-07 11:42:40 +09:00
Seonghyun Kim
3d230333be Update Intl.Locale constructor for supporting newer spec
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-07 11:42:40 +09:00
Seonghyun Kim
7454b14725 Implement Intl.DurationFormat.prototype.formatToParts
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-07 11:42:40 +09:00
Seonghyun Kim
54b0cf8f65 Implement Intl.DurationFormat, Intl.DurationFormat.supportedLocalesOf and Intl.DurationFormat.prototype.format
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-07 11:42:40 +09:00
Seonghyun Kim
c2083928a7 Remove useless check on ErrorObject::stack set function
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-01 10:16:26 +09:00
Seonghyun Kim
f00b8128a9 Update Runtime ICU binder for Windows
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-01 10:16:26 +09:00
Seonghyun Kim
db0badf787 Impelement Intl.DateTimeFormat.prototype.formatRangeToParts
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-01 10:16:26 +09:00
Seonghyun Kim
05553d2264 Impelement Intl.DateTimeFormat.prototype.formatRange
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-01 10:16:26 +09:00
Seonghyun Kim
2e33b02111 Add toStringTag to Intl.DateTimeFormat
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-01 10:16:26 +09:00
Seonghyun Kim
5de198e3a7 Revise hour12, hourCycle, locale hc extension handling in Intl.DateTimeFormat
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-01 10:16:26 +09:00
Seonghyun Kim
50299f0b15 Revise Intl.DateTimeFormat
* Parse GMT offset as timezone
* replace space (u202F) and thinSpace (u2009) from ICU result

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-08-01 10:16:26 +09:00
2jaeheon
6242f0977e Implement Iterator.prototype.flatMap method
Signed-off-by: 2jaeheon <jaeheon0826@jbnu.ac.kr>
2025-07-30 15:05:46 +09:00
2jaeheon
6d0874b866 Implement getIteratorFlattenable
Signed-off-by: 2jaeheon <jaeheon0826@jbnu.ac.kr>
2025-07-30 15:05:46 +09:00
clover2123
ae94df12b7 Disable -Os option for the latest gcc version
Signed-off-by: clover2123 <hyukwoo.park@jbnu.ac.kr>
2025-07-29 19:14:23 +09:00
Seonghyun Kim
383f275ad9 Update Intl.DateTimeFormat constructor for support Updated spec
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-23 10:30:50 +09:00
Seonghyun Kim
8d890f97ec Use collation and ignorePunctuation option correctly in Intl.Collator
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-23 10:30:50 +09:00
kwonjeomsim
953fb9163d Implement Map/WeakMap.prototype.getOrInsertComputed 2025-07-22 11:29:15 +09:00
2jaeheon
47d09c2a5f fix: Store Date value before ToNumber to handle side effects correctly
Signed-off-by: 2jaeheon <jaeheon0826@jbnu.ac.kr>
2025-07-21 09:55:18 +09:00
Seonghyun Kim
4be0de65b9 The toLocaleString method of each non-undefined non-null element must be called with two arguments.
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-21 09:09:51 +09:00
Seonghyun Kim
e640af3007 Enable Math.f16round
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-21 09:09:51 +09:00
Seonghyun Kim
0f55e4461a Implement Intl.PluralRules.selectRange
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-21 09:09:51 +09:00
Seonghyun Kim
b2ecf54887 Implement more options to Intl.PluralRules
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-21 09:09:51 +09:00
Seonghyun Kim
a264ee2026 Implement Intl.NumberFormat.prototype.formatRangeToParts function
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-21 09:09:51 +09:00
Seonghyun Kim
7b71600aa7 Implement Intl.NumberFormat.prototype.formatRange
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-21 09:09:51 +09:00
kwonjeomsim
edbdfc7888 Catch syntax error when try to increase/decrease yield and new.target keyword 2025-07-20 10:53:37 +09:00
Anwar Fuadi
0daf586b6e Implement Math.f16round(x). 2025-07-17 15:17:30 +09:00
Seonghyun Kim
f15ce4357a Update Intl.NumberFormat constructor, format and resolvedOptions method for Intl.NumberFormat V3 spec
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-16 14:20:42 +09:00
Seonghyun Kim
4da625eeee Implement new useGrouping option for NumberFormat
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-16 14:20:42 +09:00
Seonghyun Kim
eb69692309 Update test env to ICU 77
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-14 10:21:43 +09:00
Seonghyun Kim
1d1abe1e69 Implement ECMA-402 Intl.supportedValuesOf
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-14 10:21:43 +09:00
2jaeheon
5632e3f811 parser: Throw SyntaxError for non-simple left-hand side in compound assignments
Signed-off-by: 2jaeheon <jaeheon0826@jbnu.ac.kr>
2025-07-12 22:56:11 +09:00
Seonghyun Kim
6cae4dc1e2 Fix up WeakMap, WeakSet memory leak and add cctest to test WeakMap and WeakSet
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-11 13:44:38 +09:00
kwonjeomsim
8582684c0b Implement Map/WeakMap.prototype.getOrInsert 2025-07-11 10:21:47 +09:00
2jaeheon
e488659903 Implement Iterator.prototype.drop method
Signed-off-by: 2jaeheon <jaeheon0826@jbnu.ac.kr>
2025-07-10 21:49:42 +09:00
Seonghyun Kim
dfeec6e03b Fix memory leak in WeakMapObject
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-10 18:53:34 +09:00
Seonghyun Kim
f2b6d3d5e0 Try to parse date with ICU
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-10 18:53:34 +09:00
Seonghyun Kim
2405fac873 Apply unicode 17 rules to parser
- 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>
2025-07-10 18:53:34 +09:00
Seonghyun Kim
bf59245ee0 Improve small config memory usage
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-09 16:11:46 +09:00
Seonghyun Kim
49984a0247 Implement missing part of resizeble buffer
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-09 10:45:06 +09:00
Seonghyun Kim
9528f75cba Implement Math.sumPrecise
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-09 10:45:06 +09:00
Soonbeom Kwon
5c53d26131 Implement Iterator.prototype.every, take, toArray method 2025-07-07 16:32:16 +09:00
Seonghyun Kim
6ecf44ae02 Implement Atomics.pause
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-04 11:15:11 +09:00
Seonghyun Kim
84f5d459cf Read SharedArrayBuffer length before compute index
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-04 11:15:11 +09:00
2jaeheon
3274c456bd Implement Iterator.prototype.forEach method
Signed-off-by: 2jaeheon <jaeheon0826@jbnu.ac.kr>
2025-07-03 22:34:48 +09:00
2jaeheon
6d2208a3e6 Implement Iterator.prototype.some method
Signed-off-by: 2jaeheon <jaeheon0826@jbnu.ac.kr>
2025-07-03 22:34:48 +09:00
Seonghyun Kim
9b2f4723e8 Fix reading attribute code on dynamic import
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-03 14:27:34 +09:00
Seonghyun Kim
048b6e1d17 Update parser due to spec update
* fix import attribute parsing bug

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-03 14:27:34 +09:00
Soonbeom Kwon
cebb533875 Adjust iteratorFilterClosure to spec and fix counter variable 2025-07-03 12:41:03 +09:00
Soonbeom Kwon
8b2b02439f Combine IteratorData struct 2025-07-03 12:41:03 +09:00
Soonbeom Kwon
dc5ae66e0e Implement Iterator.prototype.reduce method 2025-07-03 12:41:03 +09:00
Soonbeom Kwon
d9792ddaf1 Implement Iterator.prototype.filter method 2025-07-03 12:41:03 +09:00
Seonghyun Kim
2bcc19e587 Implement Float16Array
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-02 16:15:46 +09:00
2jaeheon
901d29e3bb Implement Iterator.prototype.find method
Signed-off-by: 2jaeheon <jaeheon0826@jbnu.ac.kr>
2025-07-02 10:49:17 +09:00
Seonghyun Kim
7a47be7877 Fix JSON builtin bug related with rawJSON spec
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-01 19:39:37 +09:00
Seonghyun Kim
4c7cd64424 Implement Error.isError method
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-01 19:39:37 +09:00
Seonghyun Kim
157a309f97 Implement Promise.try method
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-01 19:39:37 +09:00
Seonghyun Kim
2986b98885 Implement RegExp.escape method
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-01 19:39:37 +09:00
Seonghyun Kim
d92a795390 Update clang-format version to 20
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-07-01 18:39:28 +09:00
Seonghyun Kim
67198fc8b0 Implement JSON.parse source text access spec
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-30 15:41:34 +09:00
Seonghyun Kim
87a09becd9 Remove nullptr ctor in Optional class to make it clearly
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-30 12:53:21 +09:00
Seonghyun Kim
2c80cd43f1 Update test262 driver and test result file
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-30 12:53:21 +09:00
Seonghyun Kim
8ae1f976d9 Update yarr version
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-30 12:53:21 +09:00
Seonghyun Kim
6a00b188d8 Implement Set.prototype.symmetricDifference method
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-25 14:15:23 +09:00
Seonghyun Kim
422dd0bc61 Implement Set.prototype.{isSubsetOf, isSupersetOf}
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-25 14:15:23 +09:00
Seonghyun Kim
dfed47ebb9 Implement Set.prototype.difference
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-25 14:15:23 +09:00
Seonghyun Kim
39d284b2b2 Implement Set.prototype.isDisjointFrom
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-25 14:15:23 +09:00
Seonghyun Kim
8984acc04f Implement Set.prototype.intersection
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-25 14:15:23 +09:00
Seonghyun Kim
04f9d99f13 Implement Set.prototype.union method
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-25 14:15:23 +09:00
Seonghyun Kim
53058a0d45 Fix clang-cl ci
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-25 14:15:23 +09:00
HyukWoo Park
a9a2335ef5 Update test262
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2025-06-25 09:53:04 +09:00
Hyukwoo Park
64db935469 Replace imp module by version-compatible importlib in test262 runner
Signed-off-by: Hyukwoo Park <hyukwoo.park@jbnu.ac.kr>
2025-06-25 09:53:04 +09:00
Hyukwoo Park
595a85757e Add pkg-config install in README
Signed-off-by: Hyukwoo Park <hyukwoo.park@jbnu.ac.kr>
2025-06-25 09:53:04 +09:00
Seonghyun Kim
a4021a97f4 Remove GC_size with alloc logic since it produces ci error
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-23 17:31:19 +09:00
Seonghyun Kim
9f59be13c2 Add tempory fix until https://github.com/actions/runner-images/issues/12435 fixed
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-23 17:31:19 +09:00
Seonghyun Kim
4c6220f22c Move tcoBuffer variable from ByteCodeInterpreter to ThreadLocal
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-23 17:31:19 +09:00
Seonghyun Kim
21f6cd3f73 Fix memory expand error on TightVectorWithNoSizeUseGCRealloc
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-19 11:09:46 +09:00
Seonghyun Kim
18a470f3f8 Disable TCs since we found some regression
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-18 17:50:07 +09:00
Seonghyun Kim
8ea4218205 Use disappearing link instead of finalizer for BackingStore
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-18 17:50:07 +09:00
Seonghyun Kim
72fc9d0680 Set GC warning proc for release mode
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-18 17:50:07 +09:00
Seonghyun Kim
fd133c5868 Use disappearing link instead of finalizer for implementing WeakRefs
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-18 17:50:07 +09:00
Seonghyun Kim
ef7441c412 Improve String hasher
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-18 17:50:07 +09:00
Seonghyun Kim
302a6ecd44 Use ParserStringView instead of AtomicString for validating parameter in esprima
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-18 17:50:07 +09:00
Seonghyun Kim
f1a7274e95 Optimize StringBuilder
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-18 17:50:07 +09:00
Seonghyun Kim
f3b070f91d Don't allocate new memory if there is enough memory in Vector
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-18 17:50:07 +09:00
Seonghyun Kim
9ae947d83b Expand object property storage when create object with construct operation
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-11 14:03:47 +09:00
Seonghyun Kim
5611aca4e1 Check length before calling memcpy
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-11 14:03:47 +09:00
Seonghyun Kim
895052f59e Use 64bit address mode on 64bit system for JNI
* some JVMs invade our 32bit address space, so we cannot use force-32bit mode with JVMs

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-09 15:51:21 +09:00
Seonghyun Kim
932d82cbf9 Replace std::list with Vector
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-09 15:51:21 +09:00
Seonghyun Kim
81e5797483 Revert StringBuilder with RopeString
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-05 22:23:12 +09:00
Seonghyun Kim
595971175c Allow template literal with new line on return statement
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-05 22:23:12 +09:00
Seonghyun Kim
ccf80322c8 Fix unicode RegExp processing bug
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-05 22:23:12 +09:00
Seonghyun Kim
72205bb381 Fix super property set error in class
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-02 12:45:48 +09:00
Seonghyun Kim
795aa354f1 Fix print error on ByteCodeGenerator
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-02 12:45:48 +09:00
Seonghyun Kim
b1a3ccc12e Update Finalizer public API
Allow multiple register of callbacks

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-02 12:45:48 +09:00
Seonghyun Kim
0e5925f7b0 Update android build files for mac, ubuntu
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-02 12:45:48 +09:00
Seonghyun Kim
62e6e01ed1 Update android build files
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-05-30 16:20:18 +09:00
Seonghyun Kim
80141b3e71 Implement PersistentRefHolder::{setWeak, isWeak, clearWeak}
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-05-30 10:21:27 +09:00
Seonghyun Kim
268306b456 Fix cmake file error
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-05-29 11:44:47 +09:00
Seonghyun Kim
58c0a0bb0a Fix subString bugs
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-05-27 11:19:42 +09:00
Seonghyun Kim
50d31696d9 Update default value of threading and update READMD.md
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-05-27 11:19:42 +09:00
Seonghyun Kim
be859fdcee Improve ENABLE_TLS_ACCESS_BY_PTHREAD_KEY
* Enable this flag in 32bit address mode in 64bit
* Use first key of pthread_create_key

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-05-27 11:19:42 +09:00
Seonghyun Kim
edb0346d4e Implement TLS access with pthread_key_t
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-05-26 09:38:29 +09:00
Seonghyun Kim
9f985fb1dc Don't make copy of large string in small config mode
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-05-20 20:44:27 +09:00
Seonghyun Kim
2a00a728ca Update GCutil
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-05-20 20:44:27 +09:00
Seonghyun Kim
2c0c041c9a Improve TLS valriable r/w on ELF shared-libary
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>
2025-05-14 14:34:31 +09:00
Seonghyun Kim
e575d34387 Update finalizer public API
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-05-12 17:54:41 +09:00
Seonghyun Kim
e4c132d591 Update GCutil
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-05-12 12:27:36 +09:00
Seonghyun Kim
aa14a49a70 Enhance Vector::erase method
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-05-12 12:27:36 +09:00
Seonghyun Kim
c2ef5b9e12 Reduce calling count of String::charAt
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-05-12 09:56:33 +09:00
Seonghyun Kim
adcd8025b7 Don't save CompressibleString and Reloadable string on AtomicStringMap
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-05-12 09:56:33 +09:00
Seonghyun Kim
ebe450e623 Calling fastTickCount function in CompressibleString is too expensive
Use last GC marking instead

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-05-12 09:56:33 +09:00
Seonghyun Kim
560cd36c21 Add VMInstance config flags
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-05-12 09:56:33 +09:00
Seonghyun Kim
7b95d4e9b8 free CreateObjectPrepare::CreateObjectData explicitly since CreateObjectData is big
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-05-12 09:56:33 +09:00
Seonghyun Kim
3aff294c29 Change default Memory::setGCFrequency value to 12 due to bdwgc update
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-05-07 11:11:38 +09:00
Seonghyun Kim
4a952115d0 Remove unnecessary strlen and memory copys
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-05-07 11:11:38 +09:00
Seonghyun Kim
ecf2a586b7 Optimize StringBuilder for huge String
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-05-07 11:11:38 +09:00
Seonghyun Kim
782269345c Update tizen build files and GCutil
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-04-30 10:17:50 +09:00
Seonghyun Kim
2b84e6b800 Update GCutil
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-04-29 12:09:43 +09:00
Seonghyun Kim
e89d796bb1 When init class, init class methods first
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-04-16 15:15:17 +09:00
Anwar Fuadi
4ebb3a229d Change from C/Function-style cast to C++-style cast. 2025-04-14 11:02:32 +09:00
Seonghyun Kim
b51cb6ff2e Add missed typed GC marking for ObjectStructureWithoutTransition
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-04-08 15:23:55 +09:00
Seonghyun Kim
5a7f8d6114 Fix script parser error with class parsing
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-04-06 16:14:09 +09:00
Seonghyun Kim
13990e9538 Add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to github workflow
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-04-03 15:14:39 +09:00
Seonghyun Kim
e78a2432cd Every value can be used in callDynamicImportRejected function
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-04-03 15:14:39 +09:00
HyukWoo Park
5f9aefa716 Fix async test script in test262
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2025-01-31 08:38:23 +09:00
HyukWoo Park
a57df7576b Fix memory leaks in Debugger
* shared structure `BreakpointLocationsInfo` between debuggger and ByteCodeBlock can cause memory leaks
* correctly delete each `BreakpointLocationsInfo`

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2025-01-17 10:44:49 +09:00
HyukWoo Park
19498b41b4 Implement PlainDate.prototype calendar-date properties
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2025-01-14 17:27:24 +09:00
HyukWoo Park
5b935ec247 Re-implement Temporal and Temporal.PlainDate basics
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2025-01-08 10:26:05 +09:00
HyukWoo Park
5cdf638814 Fix package installation failure in actions
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2025-01-07 12:23:23 +09:00
HyukWoo Park
58536d0ea0 Refactor TemporalObject
* merge Temporal into TemporalObject
* add each Temporal prototype object into global object

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-12-11 11:34:15 +09:00
HyukWoo Park
e4287d5f6b Refactor static strings for Temporal
* redefine all lazy strings of Temporal objects

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-12-11 11:34:15 +09:00
HyukWoo Park
fdec6267da Update test262 version
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-12-10 15:48:37 +09:00
HyukWoo Park
037a748d22 Handle out-of-bound access in TypedArray
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-12-10 15:48:37 +09:00
HyukWoo Park
a02c48d286 Fix bugs in RegExp
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-12-02 17:51:47 +09:00
HyukWoo Park
204295833b Skip pkg-config install in macos
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-11-26 16:48:55 +09:00
HyukWoo Park
c7623e41ce Update release action
* 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>
2024-11-26 16:48:55 +09:00
Seonghyun Kim
5c22c9f32d Update maven release files
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-11-18 15:02:41 +09:00
HyukWoo Park
6d2dd5ecec Update release actions
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-11-08 11:45:17 +09:00
HyukWoo Park
d70a651c56 Add RISC-V (64bit) test environment in actions
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-11-08 11:45:17 +09:00
HyukWoo Park
9df6de10a2 Fix a parsing bug in nullish-coalescing
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-11-07 17:49:03 +09:00
HyukWoo Park
92602e2ca2 Update release action
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-10-31 15:37:23 +09:00
HyukWoo Park
081e241c2f Fix x86 build in actions to use i386 ICU package
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-10-31 15:37:23 +09:00
HyukWoo Park
ff7b02722d Fix icu4c build path in macOS
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-10-31 15:37:23 +09:00
HyukWoo Park
98a7eaf95d Update macOS build including both x64 and arm64
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-10-23 16:34:16 +09:00
Seonghyun Kim
2f3ba80a08 Fix one of assignment optimizer bug
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-10-21 10:56:13 +09:00
HyukWoo Park
cf0ef1247b Update macOS version in actions
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-10-16 16:17:51 +09:00
Seonghyun Kim
f388c52797 Fix crash while buildStacktrace
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-10-10 10:45:05 +09:00
HyukWoo Park
cd4b7ddbea Fix minor parsing errors
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-09-27 08:16:34 +09:00
Seonghyun Kim
7365c2ae4b Fix crash when got stack overflow error while computing bytecode position
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-09-24 10:18:56 +09:00
Seonghyun Kim
32f1ebbd26 Fix bug in callConstructor with class
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-09-19 14:32:57 +09:00
HyukWoo Park
91eef62f47 Refactor parsing of optional chaining
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-09-19 13:48:53 +09:00
Seonghyun Kim
1e1599aa09 Implement ValueRef::callConsturctor
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-09-13 16:14:22 +09:00
HyukWoo Park
0434ba9237 Fix this binding error within eval and arrow function
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-09-12 20:20:07 +09:00
HyukWoo Park
0eac4dcff9 Add stack checker in Proxy call and construct methods
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-09-12 20:20:07 +09:00
Seonghyun Kim
55d3c17718 ByteCodeBlock of top CodeBlock should not be removed from VMInstance
* 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>
2024-09-10 13:53:32 +09:00
HyukWoo Park
6a0087c6cb Fix minor defect in Yarr
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-09-09 15:50:08 +09:00
HyukWoo Park
e801bb623f Update README
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-09-09 15:49:45 +09:00
HyukWoo Park
5fcdf4e101 Fix generation of arguments object used in nested arrow functions and eval codes
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-09-05 10:38:47 +09:00
HyukWoo Park
7589396230 Fix calculation of identifiers located in parameter scoped functions
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-08-30 09:37:09 +09:00
HyukWoo Park
d398f1ece3 Fix minor type-casting defect in TypedArray
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-08-20 18:30:53 +09:00
HyukWoo Park
cadbad68b9 Update README
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-08-20 18:30:53 +09:00
Seonghyun Kim
2ec730bed4 Implement basic of Iterator helper and Iterator.prototype.map
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-08-09 15:40:40 +09:00
HyukWoo Park
23ef57997a Fix minor buffer overflow in lexer
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-08-06 15:34:25 +09:00
HyukWoo Park
fff4e2fdd4 Fix minor build errors for clang compiler
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-08-06 15:34:25 +09:00
HyukWoo Park
3045a8ef7e Add android release in actions
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-08-05 09:21:27 +09:00
HyukWoo Park
dd479c42bb Update android build
* update NDK version 27
* enable 16KB page size

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-07-31 17:52:47 +09:00
Seonghyun Kim
0f6ea4612a Fix memory error on Yarr
If we want to store WTF::String with Vector or HashSet,
we would use another type of allocator

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-25 16:29:03 +09:00
Seonghyun Kim
96d165ff5a Fix test262 driver error around IsAsyncTest function
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-25 16:29:03 +09:00
Seonghyun Kim
adf735966f DataViewObject sometimes have true for m_isAuto & detached when byteLength is below zero
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-25 16:29:03 +09:00
Seonghyun Kim
023bb16baa Revise Array, ArrayBuffer, BigInt, DataView builtins
* Implement missing features on ArrayBuffer
* Fix minor bug on BigInt, DataView and Array

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-25 16:29:03 +09:00
Seonghyun Kim
902d76f0dd Update yarr generated unicode data file to unicode 15.1
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-25 16:29:03 +09:00
HyukWoo Park
246ecf6456 Fix buffer overflow error in RegExp
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-07-25 12:35:25 +09:00
HyukWoo Park
b7a70c5c33 Update WASM js-api
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-07-25 10:07:09 +09:00
Seonghyun Kim
9b1076d5c6 Update yarr generated unicode data file to unicode 15.1
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-24 10:21:42 +09:00
Seonghyun Kim
21903f956e In RegExp ctor, we should replace \n into \\n
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-24 10:21:42 +09:00
Seonghyun Kim
7762be63d1 Implement accessor unicodeSets for RegExp prototype
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-24 10:21:42 +09:00
Seonghyun Kim
6374a4857d Fix unicode string indexing bug in RegExpExec
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-24 10:21:42 +09:00
Seonghyun Kim
a66b725ce4 RegExp.prototype[Symbols.match] builtin function should read flags property instead of global
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-24 10:21:42 +09:00
Seonghyun Kim
eda2f8d4fa If there is unicode flag is set but find un-paired utf-16 surrogate in RegExp interpreter,
We should not use utf-16 surrogate pair rule for input.

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-24 10:21:42 +09:00
HyukWoo Park
7fc59b7171 Revise WASM cache structure
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-07-18 16:15:23 +09:00
HyukWoo Park
f07651568b Update wasm-js testsuite
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-07-18 16:15:23 +09:00
HyukWoo Park
19f32213ee Fix test runner to print out fail list
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-07-18 16:15:23 +09:00
Seonghyun Kim
0fbacc3b2e Fix Unicode Identifier paring bug
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-18 14:27:49 +09:00
Seonghyun Kim
b95ae71b67 Fix Bug in RegExpObject::createRegExpMatchedArray
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-18 14:27:49 +09:00
HyukWoo Park
6c0926c4c0 Fix out-of-bound source code accesses in Lexer
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-07-16 15:47:40 +09:00
Seonghyun Kim
bddd8a8fe2 RegExp.prototype.compile should not accept sub-class of RegExp
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-16 14:25:28 +09:00
Seonghyun Kim
b3deb87407 Add YarrSyntaxChecker to test RegExp pattern and flag
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-16 14:25:28 +09:00
Seonghyun Kim
9c09d721af Implement 'd' flag for RegExp
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-16 14:25:28 +09:00
Seonghyun Kim
9876b4c852 Fix parse RegExp option bug
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-16 14:25:28 +09:00
Seonghyun Kim
4c2efa224e Implement StackCheck in yarr
* Move many WTF class from WTFBridge to class file

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-16 14:25:28 +09:00
Seonghyun Kim
3d4d9a9f2b RegExp.prototype.compile method should check the function is called by cross-realm
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-16 14:25:28 +09:00
Seonghyun Kim
8ac5782dec Update test262 exclude file
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-12 16:44:02 +09:00
Seonghyun Kim
72cb18b19b in RegExp(yarr), UCHAR_ALPHABETIC chars not applied by u_tolower, u_toupper
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-12 16:44:02 +09:00
Seonghyun Kim
4b8024efb7 Update yarr source to webkitgtk-2.44.2
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-12 16:44:02 +09:00
HyukWoo Park
01bfe58f7f Fix wrong memory allocation of ToStringRecursionPreventer in VMInstance
* fix it to make GC correctly trace ToStringRecursionPreventer structure

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-07-05 10:21:05 +09:00
Seonghyun Kim
e2423b2428 Fix shell and test262 driver bug
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-04 13:41:04 +09:00
Seonghyun Kim
d59154a794 Implement String.prototype.{ isWellFormed, toWellFormed }
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-04 13:38:59 +09:00
Seonghyun Kim
18ec8bc1fc Fix bug when resize size of ArrayBuffer from zero
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-04 13:35:01 +09:00
Seonghyun Kim
d9bfe96623 Implement Promise.withResolvers
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-03 09:48:25 +09:00
Seonghyun Kim
23d21fd7ec Implement Map.groupBy
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-03 09:48:25 +09:00
Seonghyun Kim
277738e347 Implement Object.groupBy method
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-07-03 09:48:25 +09:00
Seonghyun Kim
db24c809c8 Add missing function if there is no ENABLE_COMPRESSIBLE_STRING flag
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-06-28 12:06:58 +09:00
HyukWoo Park
3024cb7065 Add codecov configuration file
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-06-28 10:59:12 +09:00
HyukWoo Park
1053742b3d Fix coverage analysis command to correctly collect infos
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-06-20 09:58:16 +09:00
Seonghyun Kim
000a19868f Prune Async, Generator function ByteCodeBlock if possible
* Don't hold Async, Generator function ByteCodeBlock while GC

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-06-19 13:26:12 +09:00
Seonghyun Kim
f646e364a7 Fix error on run-tests.py
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-06-13 12:40:30 +09:00
HyukWoo Park
1050ee4f5b Update TCO debug mode
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-06-05 11:06:25 +09:00
Seonghyun Kim
25fe6b8d5a Update spec file and run-test tool
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-05-28 17:05:50 +09:00
HyukWoo Park
5d5e89f6d8 Replace every getIndexedProperty by getIndexedPropertyValue in TypedArray builtin methods
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-05-28 14:29:56 +09:00
HyukWoo Park
91c83757e5 Update TypedArray.prototype.toReversed builtin method
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-05-28 14:29:56 +09:00
HyukWoo Park
b692b277d0 Update Array.prototype.toReversed builtin method
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-05-28 14:29:56 +09:00
HyukWoo Park
23d203b7b2 Update Array.prototype.toSpliced builtin method
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-05-28 14:29:56 +09:00
HyukWoo Park
47cc02e8d8 Update TypedArray.prototype.toSorted builtin method
* fix some errors in sort method too
* refactor other sort and toSorted methods

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-05-23 17:02:15 +09:00
HyukWoo Park
696cff8d27 Fix bugs in Array.prototype.sort
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-05-23 17:02:15 +09:00
HyukWoo Park
f5a08722e9 Update Array.prototype.toSorted builtin method
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-05-23 17:02:15 +09:00
HyukWoo Park
52e3239f63 Update build options and submodules
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-05-22 17:40:10 +09:00
HyukWoo Park
57c23d62f0 Fix Error creation process to check and trigger Error relevant callbacks correctly
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-05-14 10:08:26 +09:00
HyukWoo Park
77f0c49ad5 Add ESCARGOT_USE_EXTENDED_API build option to managed APIs used only for third party
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-05-14 10:08:26 +09:00
Seonghyun Kim
a34205a555 Remove AVD cache from CI
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-05-07 09:23:02 +09:00
Seonghyun Kim
af5ac14862 When finalize ThreadLocal, we should remove gc event listener from bdwgc
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-05-07 09:23:02 +09:00
HyukWoo Park
f039511557 Fix calculation of outer limit of complex jump correctly
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-05-02 10:17:14 +09:00
HyukWoo Park
2c36e6eb67 Remove redundant code modules in complex jump
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-05-02 10:17:14 +09:00
HyukWoo Park
08eb095b3c Replace checks of undefined or null routine in for statement by one unified bytecode
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-05-02 10:17:14 +09:00
HyukWoo Park
5ec3d007fa Fix build error in actions CI
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-05-02 10:17:14 +09:00
HyukWoo Park
fdda755329 Fix not to store duplicated properties in Template
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-04-24 15:43:07 +09:00
HyukWoo Park
29ea705677 Mark structure as referenced by inline caching for template
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-04-24 15:43:07 +09:00
HyukWoo Park
05d1dadbe4 LoadLiteral bytecode should have a seperate dst register
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-04-24 15:43:07 +09:00
HyukWoo Park
fa209656d5 Reset m_fastModeData of ArrayObject for the case of exception during ArrayObject creation
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-04-24 15:43:07 +09:00
HyukWoo Park
28451a704f Update Walrus module
* fix build error

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-04-05 12:08:07 +09:00
HyukWoo Park
5a5238049c Implement Immutable Prototype Exotic Object
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-04-03 16:49:20 +09:00
HyukWoo Park
99f7a16312 Fix to access global builtin properties before delete operation
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-03-28 16:35:15 +09:00
HyukWoo Park
33037e20d8 Throw an exception when attributes parameter of Reflect.defineProperty is not an Object
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-03-28 16:35:15 +09:00
HyukWoo Park
5f918f17e6 Fix an error in getting a new.target method
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-03-28 16:35:15 +09:00
HyukWoo Park
46cd288264 Fix parsing error about await keyword
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-03-28 16:35:15 +09:00
HyukWoo Park
870bc3991a Fix the type of GeneratorFunction.prototype
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-03-26 13:29:51 +09:00
HyukWoo Park
232a555df2 Fix optional chaining parsing to correctly throw a syntax error for left-hand side assignment
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-03-26 13:29:51 +09:00
HyukWoo Park
2bde2b91e3 Fix wrong register calculation in AssignmentExpressionSimpleNode
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-03-26 13:29:51 +09:00
HyukWoo Park
babcedce95 Adjust buffer size of source code loading
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-03-20 14:57:06 +09:00
HyukWoo Park
01c132434c Fix missing parameters in collectByteCodeLOCData
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-03-20 14:57:06 +09:00
HyukWoo Park
23cbadecad Add missing type check in left-hand-expression parsing
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-03-20 14:57:06 +09:00
HyukWoo Park
5ee4a5bd4e Fix buffer overflow error in builtinHelperFileRead method
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-03-15 09:30:40 +09:00
HyukWoo Park
bccdc4225e Update deprecated actions modules
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-03-12 13:50:42 +09:00
HyukWoo Park
86525d1000 Fix object set inline caching method
* 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>
2024-03-12 13:50:42 +09:00
HyukWoo Park
5275ce42e3 Remove unnecessary codes in ObjectStructure
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-03-12 13:50:42 +09:00
HyukWoo Park
023b7ea014 Implement general tail call optimization
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-02-20 17:16:10 +09:00
Seonghyun Kim
65558531f8 Fix yml file to run test cases on test machine
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-02-14 15:28:56 +09:00
Seonghyun Kim
6218b1bafc Update GCutil and object value allocator for fix performance problem
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>
2024-02-14 15:28:56 +09:00
HyukWoo Park
c4ab1cf57d Merge tail call bytecodes
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-02-05 14:19:01 +09:00
Seonghyun Kim
55a36a294a Fix crash
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>
2024-02-01 10:49:00 +09:00
Seonghyun Kim
c884c0605b Improve Object creation performance
* Convert rootedObjectStructureSet(Vector) into HashSet
* Use inline storage for properties in CreateObjectData

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-02-01 10:49:00 +09:00
Seonghyun Kim
2b6e3fcc7d Update object creation code from script
* Use ObjectCreatePrepare code everytime
* Implement simple inline-cache object structure in ObjectCreatePrepare

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-02-01 10:49:00 +09:00
Seonghyun Kim
9a5c1b57a9 Add google-perf build option
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-02-01 10:49:00 +09:00
Seonghyun Kim
bd95de3c46 Implement more things for CreateObjectPrepare operation
* It should support methods and spread element

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-01-18 16:40:37 +09:00
Seonghyun Kim
ded2d1145e Introduce new way of create object in script
* 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>
2024-01-18 16:40:37 +09:00
Seonghyun Kim
70a5bf444a Fix bugs on Temporal
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-01-18 16:40:37 +09:00
HyukWoo Park
f09fe2a4c0 Fix buffer overflow in text reading
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-01-16 15:59:02 +09:00
HyukWoo Park
3aac2156a9 Fix FinalizationRegistry
* unregisterToken should be weak reference
* add finalizer for unregisterToken
* fix cleanupSome method

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-01-12 18:50:50 +09:00
HyukWoo Park
47b9fb1074 Implement FinalizationRegistry of Symbol type
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-01-12 15:08:35 +09:00
HyukWoo Park
364b5f4717 Implement WeakRef of Symbol type
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-01-12 15:08:35 +09:00
HyukWoo Park
1749160613 Implement Symbol value of WeakSet
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-01-12 15:08:35 +09:00
HyukWoo Park
9dc7a55cbe Implement Symbol key of WeakMap
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-01-12 15:08:35 +09:00
Zoltan Herczeg
ac75d5c715 Fix memory and conversion issues in python debugger
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2024-01-12 12:18:53 +09:00
HyukWoo Park
ca43b39174 Revise Symbol description getter methods
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-01-10 14:34:43 +09:00
HyukWoo Park
86f230325f Implement finalizer for Symbol
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-01-10 14:34:43 +09:00
HyukWoo Park
1982e20d42 Remove redundant checks in Object conversion macro
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-01-08 09:46:36 +09:00
HyukWoo Park
96762b2187 Update TypedArray.prototype.with
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-01-04 10:09:32 +09:00
HyukWoo Park
9e87e85dc7 Update Array.prototype.with
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-01-04 10:09:32 +09:00
HyukWoo Park
a4afdefbf2 Fix defects
* using references for auto variables
* embed identifier operations for non-generic block infos

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2024-01-03 08:54:05 +09:00
Seonghyun Kim
5170135d7b Implement generic BlockInfo vector for CodeBlock for reducing memory usage
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2024-01-02 15:09:40 +09:00
Seonghyun Kim
1b9be45708 Add Generic-BlockInfo for reducing memory usage of BlockInfo
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-12-28 09:31:13 +09:00
Seonghyun Kim
b0543cfe9c Use realloc for ByteCodeGeneration
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-12-28 09:31:13 +09:00
HyukWoo Park
c12763a4df Update test262 version
* fix an error in TemporalObject

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-12-20 16:00:08 +09:00
HyukWoo Park
282cd3f359 Add timeout limits for hosted-runners in actions
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-12-20 16:00:08 +09:00
HyukWoo Park
698b932878 Fix broken badge in README
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-12-20 16:00:08 +09:00
HyukWoo Park
3026aab3ca Fix minor code defects
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-12-19 10:24:18 +09:00
HyukWoo Park
a3fa9d7ef0 Fix parsing bugs in increment or decrement operations
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-12-18 08:41:26 +09:00
HyukWoo Park
dcbcd7dac5 Add untracked flag for web-tooling-benchmark submodule
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-12-18 08:41:26 +09:00
HyukWoo Park
9bc09564f4 Fix parsing bugs in UnaryExpression and Exponentiation operation
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-12-15 15:07:53 +09:00
HyukWoo Park
4121b297fc Run web-tooling-benchmark in actions
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-12-12 17:09:31 +09:00
HyukWoo Park
b50e5fcf8c Add web-tooling-benchmark test
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-12-12 17:09:31 +09:00
HyukWoo Park
93d4648908 Refactor Code Cache
* reduce FILE I/O to accelerate load/store process
* add code caching functions for clean code

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-12-08 08:44:25 +09:00
Seonghyun Kim
59a626b871 Improve performance with large object
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-12-07 16:36:24 +09:00
Seonghyun Kim
5d59757208 Optimize JSON.parse with large input
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-12-07 16:36:24 +09:00
Seonghyun Kim
b117b8b205 Optimize JSONStringifyQuote
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-12-07 16:36:24 +09:00
HyukWoo Park
8aa918e372 Fix a wrong assertion in tail call without parameters
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-12-06 13:09:38 +09:00
Seonghyun Kim
799bc4fcc9 Fix global-await issue
* Print unhandled reject error for developer in shell
* Fix await expression parsing bug

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-12-01 10:47:36 +09:00
Seonghyun Kim
184295ccb6 Use string length with hash for identify source code in CodeCache
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-11-30 10:03:22 +09:00
Seonghyun Kim
41206722f0 Fix SIGBUS on arm cpu
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-11-29 13:13:46 +09:00
Seonghyun Kim
f04616e4a5 Make every function cacheable even if script is not cacheable
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-11-29 13:13:46 +09:00
Seonghyun Kim
2c070415ba Revise load/store CodeCache for function
* 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>
2023-11-29 13:13:46 +09:00
HyukWoo Park
5bc5fc7876 Add fine-tuned TCO condition check in parsing phase
* check argument count and name of callee

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-11-23 08:26:09 +09:00
HyukWoo Park
1a5b10b821 Simplify TCO check code
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-11-23 08:26:09 +09:00
HyukWoo Park
11d9427bb8 Update TCO to handle tail recursion with non-identical argument counts
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-11-23 08:26:09 +09:00
Seonghyun Kim
e9cec1d0b4 Make option for maxCompiledByteCodeSize in VMInstance
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-11-21 14:49:31 +09:00
Seonghyun Kim
fcc35d22bf Implement experimental code cache of function
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-11-21 14:49:31 +09:00
Seonghyun Kim
195039d901 Revise computing and using stack limit
* 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>
2023-11-20 13:31:17 +09:00
Seonghyun Kim
48150217a8 Divide ExectuionState to ExecutionState and ExtendedExecutionState(with rareData)
* This path reduce gc_malloc count for try-catch, with, generator, async function

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-11-20 13:31:17 +09:00
Seonghyun Kim
4f8582ec25 Compute stacktrace when creating ErrorObject
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-11-09 12:15:14 +09:00
HyukWoo Park
4581040747 Implement TCO for try-catch-finally block
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-11-08 15:16:42 +09:00
Seonghyun Kim
e706ea6e4a Implement Context.throwException on Java API
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-11-03 10:51:03 +09:00
Seonghyun Kim
4053e103a5 Add missing license file
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-11-01 12:50:15 +09:00
Seonghyun Kim
2ecb52c9cd Implement JavaErrorObject in JNI
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-11-01 12:50:15 +09:00
Seonghyun Kim
d7cf6a58ce Add self-hosted github action machine instead of using jenkins
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-10-31 13:04:31 +09:00
Seonghyun Kim
5c797fa5ac Add example of MultiThreadExecutor
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-10-30 11:14:37 +09:00
Seonghyun Kim
2bd31a2136 Implement MultiThreadExecutor on Java API
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-10-30 11:14:37 +09:00
Seonghyun Kim
5b91e4bb2d Update API
* add Promise builtin, Object::setLength apis on native & java

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-10-30 11:14:37 +09:00
Seonghyun Kim
bd4b29364b Implement setExtraData, extraData on JavaScriptObject
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-10-25 14:21:10 +09:00
Seonghyun Kim
f33168c6f6 Divide one big JNI file into multiple files
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-10-25 14:21:10 +09:00
HyukWoo Park
49fd86eae8 Enable try operation APIs only for test mode
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-10-25 11:23:41 +09:00
HyukWoo Park
28f1f0fb0b Remove unused parameter in toBoolean method
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-10-25 11:23:41 +09:00
HyukWoo Park
f77f28fa84 Fix an error in calculation of ExecutionPause length for Code Cache
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-10-25 11:20:43 +09:00
Seonghyun Kim
97e698db34 Fix bug with top-level-await with class variable init
* Prevent native stack overflow
* Fix bug in ExecutionState::inPauserScope

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-10-24 14:25:01 +09:00
HyukWoo Park
7f7d8c336d Apply TCO for sequence and logical operations located at the end of the return statement
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-10-23 16:03:30 +09:00
Seonghyun Kim
cdb47df97f Generate EscargotInfo.h file in CMAKE_BINARY_DIR/escargot_generated/ not on src
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-10-19 12:07:35 +09:00
Seonghyun Kim
98133d2206 Update Java API
* 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>
2023-10-18 17:25:45 +09:00
HyukWoo Park
463d73023a Fix tests according to the update in stack tracing
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-10-17 17:46:14 +09:00
HyukWoo Park
f41a422302 Fix execution state traversal in stack tracing
* 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>
2023-10-17 17:46:14 +09:00
Seonghyun Kim
7697c00fef Add promise API in java layer
* Update android gradle version

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-10-11 19:02:40 +09:00
Seonghyun Kim
27f44f396d Use robin_map by add include directory instead of adding sub directory in cmake
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-10-05 17:39:41 +09:00
Seonghyun Kim
ae1ba12763 Update mac android build files
* Fix TypedArrayObject.prototye.indexOf bug

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-09-15 11:03:19 +09:00
HyukWoo Park
f79cdc8f0c Fix error in analysis action
* update wasm build of walrus

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-09-15 10:43:31 +09:00
HyukWoo Park
e7ab0df730 Add WASM build test
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-09-12 14:52:29 +09:00
HyukWoo Park
730853fecb Replace wasm engine with walrus
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-09-12 14:52:29 +09:00
Seonghyun Kim
ccb11a6ce1 Fix binary precedence bug
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-09-12 12:57:23 +09:00
Seonghyun Kim
f6cdc00259 Optimize TypedArrayObject.prototype.set, indexOf, lastIndexOf
* Update cmakefile

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-09-12 12:57:23 +09:00
Seonghyun Kim
2141345fc0 Fix async arrow function parser bug
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-09-01 13:33:00 +09:00
HyukWoo Park
f56ea256b4 Fix minor code defects
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-08-11 15:07:48 +09:00
HyukWoo Park
b09fdcb929 Replace redundant sandbox runs with try-catch statement
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-08-11 15:07:48 +09:00
HyukWoo Park
b980f68488 Fix minor code defects
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-07-25 10:47:49 +09:00
Seonghyun Kim
498966bca1 Implement riscv64 build support
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-07-24 16:57:25 +09:00
Seonghyun Kim
95aa9934a0 Add arm32 test
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-07-24 11:17:03 +09:00
Seonghyun Kim
87fda52727 Fix crash with ObjectStructureWithMap and inline cache
If inline cache refers ObjectStructure, ObjectStructure should keep its contents.

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-07-20 10:58:53 +09:00
Seonghyun Kim
74735f9029 Update public API for using NewTarget from outside of escargot
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-07-18 18:58:52 +09:00
Seonghyun Kim
0c834fe76d Update Jenkinsfiles
* add arm64 version of jenkins
* fix arm64-gcc issue

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-07-18 16:44:16 +09:00
Seonghyun Kim
2cc4dc09c1 Update build files
* 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>
2023-07-17 10:04:23 +09:00
Seonghyun Kim
0927db97c5 Fix issues on ARM32
* 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>
2023-07-17 10:04:23 +09:00
HyukWoo Park
78d2520e8b Fix code format of robin_map
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-07-14 13:31:37 +09:00
HyukWoo Park
7b207535e3 Fix minor defect
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-07-14 13:31:37 +09:00
Seonghyun Kim
4913754c32 Implement building with clang-cl
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-07-12 16:46:42 +09:00
Seonghyun Kim
da856ccac9 Implement Windows x64 UWP and x86 DLL build test on github action
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-07-12 16:46:42 +09:00
Seonghyun Kim
a2886b8db1 Update source and test driver for running test262 on windows
* 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>
2023-07-07 09:20:04 +09:00
Seonghyun Kim
1353d2e1a5 update shell
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-07-07 09:20:04 +09:00
Seonghyun Kim
7946cb8d09 Use own vector instead of std::vector in robin_hash
* using std::vector with bdwgc can cause leak from std::vector

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-07-07 09:20:04 +09:00
Seonghyun Kim
67216fcac9 Replace gc-allocated std::{unordered_map,unordered_set} with robin-{map,set}
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-07-07 09:20:04 +09:00
Seonghyun Kim
e5ea30b06c Add robin-map library as third_party
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-07-07 09:20:04 +09:00
Seonghyun Kim
3a3ef88853 Implement building on Win64
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-06-29 10:12:59 +09:00
Seonghyun Kim
0596de75c8 Update windows build
* 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>
2023-06-22 13:31:23 +09:00
Seonghyun Kim
3aaded1210 Use ucal_* API instead of vzone_* API of ICU
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-06-19 11:37:25 +09:00
Seonghyun Kim
34182762c1 Fix evaluation bug of UpdateExpression with MemberExpression
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-06-14 12:38:57 +09:00
Seonghyun Kim
9093a7244b Implment tizen build of escargot
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-06-14 12:38:57 +09:00
Seonghyun Kim
003d417972 Revise minor things
* 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>
2023-06-07 15:32:57 +09:00
Seonghyun Kim
c352be9893 Use tryToUseAsIndex32 instead of toIndex in JSON string replacer
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-05-31 14:30:10 +09:00
HyukWoo Park
e84107d418 Remove unused parameters in ByteCode macro
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-05-31 12:49:24 +09:00
HyukWoo Park
e275ba66f5 Remove an unused variable in ALLOCA
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-05-31 12:49:24 +09:00
HyukWoo Park
7e68583b56 Fix a bug that interpreter reuses an argument buffer of caller in tail call
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-05-30 14:20:41 +09:00
Seonghyun Kim
0c1a12541b Update test driver
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-05-30 11:47:58 +09:00
Seonghyun Kim
66489b7660 Implement dumping and run v8 test
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-05-30 11:47:58 +09:00
Seonghyun Kim
3894bfec5d Enable more v8 tests
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-05-30 11:47:58 +09:00
Seonghyun Kim
e007a9d4eb Fix minor issues
* 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>
2023-05-30 11:47:58 +09:00
Seonghyun Kim
eb1380ea95 Implement SIGSEGV, SIGABRT handler for easier debugging on android
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-05-19 13:45:56 +09:00
Seonghyun Kim
9581488a11 Update test files regarding to dump and run spidermonkey on android
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-05-19 13:45:56 +09:00
HyukWoo Park
0285779f67 Expand TCO on nullish and conditional expression
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-05-11 15:57:28 +09:00
HyukWoo Park
f621248ccc Update tail calls not to generate End bytecode
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-05-11 15:57:28 +09:00
Seonghyun Kim
015d4bd2bd Update java Runtime Exception processing in JNI
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-05-09 11:00:19 +09:00
Seonghyun Kim
930e5a7636 Process Java RuntimeException with JS exception instead of native exception
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-05-08 18:07:06 +09:00
HyukWoo Park
1fbf4872c7 Add a build option of tail call optimization
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-05-08 17:05:02 +09:00
Seonghyun Kim
b0106ced1c Update for android-JNI api
* Add ESCARGOT_BUILD_64BIT_FORCE_LARGE option to android build
* Don't ignore RuntimeExection of java

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-05-08 14:03:30 +09:00
HyukWoo Park
283873a291 Implement basic tail call optimization for normal function
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-05-03 11:18:25 +09:00
HyukWoo Park
0e0b759817 Include breakpoint bytecodes only for debugger mode
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-05-03 11:18:25 +09:00
Seonghyun Kim
6fcb1afb47 Android should use large-64bit mode when exporting aar
+ set abort handler to bdwgc

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-05-02 17:56:35 +09:00
HyukWoo Park
02e9b999e9 Fix error in optional chaining
* should trigger an exception when callee or target object is indeed undefined in optional chaining

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-04-28 12:14:30 +09:00
Seonghyun Kim
f9c41a5c65 AssignmentExpressionSimpleNode should have own getRegsiter method
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-04-27 16:21:18 +09:00
Seonghyun Kim
435c536848 Throw jni so load failed exception only if failed in linux, mac
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-04-27 16:21:18 +09:00
Seonghyun Kim
9a4371398f Update JNI build file and Java sources
* Add jacocoTestReport command to generate coverage

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-04-26 13:58:10 +09:00
Seonghyun Kim
25539bd485 Update JNI test case to count test case number
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-04-26 13:58:10 +09:00
Seonghyun Kim
9a29ca809d Use getprop command instead of ICU for getting system timezone
* Old version of ICU doesn't return IANA timezone id when call ucal_getDefaultTimeZone

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-04-24 16:45:45 +09:00
Seonghyun Kim
6a84aefa64 We need to check the callback was deleted before calling in FinalizationRegistryObject
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-04-24 16:45:45 +09:00
Seonghyun Kim
6b43e1c44a Fix float conversion problem
* 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>
2023-04-24 16:45:45 +09:00
Seonghyun Kim
bcbbfe212d Reading float unaligned address raises SIGBUS in armeabi-v7a
* read unaligned address as int & turn off optimization

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-04-24 16:45:45 +09:00
HyukWoo Park
94c1a60de3 Update sam exclude file with comments
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-04-21 14:47:59 +09:00
HyukWoo Park
8f5311010e Make test scripts be compatible with python3
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-04-21 14:47:59 +09:00
Seonghyun Kim
7a98a9ba52 Update timezone and locale codes
* Use ICU function for reading default system timezone
* Update default locale reading logic(remove POSIX postfix & ignore 'C' locale)
* Refactor global timezone, vzone, tzname codes

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-04-20 20:48:23 +09:00
Seonghyun Kim
80fea01dd1 Update test262-runner and Android build files
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-04-20 20:48:23 +09:00
Seonghyun Kim
e4bb91a79f Use int8_t instead of char
* c++ spec not specify char is signed

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-04-20 20:48:23 +09:00
Seonghyun Kim
e4e7144f94 Fix bugs
* 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>
2023-04-17 14:22:18 +09:00
Seonghyun Kim
e6e34a3a9d Implement dumping test262 data into disk for running test262 without python
* Implement test262 runner for test which is dumped by tool

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-04-17 11:00:16 +09:00
HyukWoo Park
c35bd083b5 Remove unused member in ByteCodeGenerateContext
* remove m_openedNonBlockEnvCount

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-04-17 09:16:01 +09:00
HyukWoo Park
c8cc70d83e Update Stack Overflow checker and disabler
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-04-17 09:16:01 +09:00
HyukWoo Park
4c144d0383 Update googletest to the latest release version
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-04-17 09:16:01 +09:00
Seonghyun Kim
fbbad63f6e Update android build files
* 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>
2023-04-10 20:02:17 +09:00
HyukWoo Park
16720128aa Update coverage scan
* 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>
2023-04-10 16:30:43 +09:00
HyukWoo Park
fa917e8668 Revise github actions with coverage test
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-04-07 16:57:15 +09:00
Seonghyun Kim
dd010ab68e Divide Value::Value(double) into Value(DoubleToIntConvertibleTestNeedsTag, double) and Value(UnconvertibleDoubleToInt32 v)
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-04-06 16:41:23 +09:00
HyukWoo Park
3e1fa28c8f Release v4.0.0
* support ECMAScript2022
* enable WASM
* enable debugger and vscode extension
* enable multi target/platform builds
* optimize performance/memory
* fix bugs

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-04-05 13:26:23 +09:00
HyukWoo Park
8f475978f1 Fix a build warning in RuntimeICUBinder
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-04-05 13:26:23 +09:00
Seonghyun Kim
7414ebda02 Introduce new Value ctor for NaN, Infinity regard to fix arm clang issue
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>
2023-04-04 14:12:32 +09:00
Seonghyun Kim
8b7456d330 Update android test shell and add arm clang test
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-04-04 14:12:32 +09:00
HyukWoo Park
7175b19a11 Update ahub exclude list
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-04-03 11:22:51 +09:00
HyukWoo Park
4b3dec1d17 Relieve code complexity in intl modules
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-04-03 11:22:51 +09:00
HyukWoo Park
adef94b097 Reduce code complexity in builtinStringReplace method
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-04-03 11:22:51 +09:00
HyukWoo Park
f4aebb65ba Reduce Cyclomatic Complexity (CC) in Intl and Date
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-04-03 11:22:51 +09:00
HyukWoo Park
53289897e8 Add AssignmentExpressionNode interface
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-04-03 11:22:51 +09:00
HyukWoo Park
bf3f885519 Remove cycle dependency from interpreter to parser
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-04-03 11:22:51 +09:00
HyukWoo Park
2b31effd4f Remove cycle dependency in CodeBlock
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-04-03 11:22:51 +09:00
Seonghyun Kim
a6ec162bd8 Fix bugs
* 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>
2023-03-30 13:10:13 +09:00
Seonghyun Kim
496e3cee71 Update GCutil and build flags
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-03-30 13:10:13 +09:00
HyukWoo Park
de4c7eb0db Eliminate duplicated code
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-03-28 16:17:00 +09:00
HyukWoo Park
2046b1faa9 Divide Interpreter module into Interpreter and InterpreterSlowPath
* to reduce the total size of Interpreter module

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-03-28 16:17:00 +09:00
HyukWoo Park
9f93022d78 Unlink circular dependency between runtime and parser source codes
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-03-28 16:17:00 +09:00
HyukWoo Park
4ae794b901 Remove redundant header files
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-03-28 16:17:00 +09:00
HyukWoo Park
4d884e66c6 Remove duplicated code in ScriptParser
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-03-28 16:17:00 +09:00
HyukWoo Park
9e3ac3931c Reduce CyclomaticComplexity (CC) in Intl module
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-03-28 16:17:00 +09:00
HyukWoo Park
ef0b3d56ea Add exclude list for sam analysis
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-03-21 12:43:54 +09:00
Seonghyun Kim
ba9cb2b21a Every JNI method should check java-null-reference
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-03-21 09:55:23 +09:00
Seonghyun Kim
ce768a627e Add null checking for Object and Value functions in JNI
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-03-21 09:55:23 +09:00
Seonghyun Kim
3dba75cdaa Implement null check for VMInstance, Context, Evaluator in jni
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-03-21 09:55:23 +09:00
Seonghyun Kim
b3c9846f2a Update android test shell app & remove unused functions on android
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-03-21 09:55:23 +09:00
Seonghyun Kim
e0fbe20f01 Improve JNI memory management
* 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>
2023-03-13 19:27:58 +09:00
Seonghyun Kim
8843d2682e Implement JavaScriptJavaCallbackFunctionObject
It has a Java callback what can be called from JavaScript

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-03-13 19:27:58 +09:00
HyukWoo Park
8d7e353073 Fill omitted member initializations
* fix minor code defects

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-03-13 17:29:13 +09:00
Seonghyun Kim
6e3220bb1d Prevent multiple escargot-jni so copying from multi thread or multi process
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-03-10 16:43:59 +09:00
Seonghyun Kim
c1d3b8c142 Implement FunctionObject and consturct expression for JNI
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-03-10 16:43:59 +09:00
Seonghyun Kim
97cf33f533 Update RuntimeICUBinder
When dlopen icu so, we should try to load so with version like libicuuc.so.63

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-03-08 16:16:08 +09:00
Seonghyun Kim
559fa4e0fe Implement BigInt API in JNI
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-03-08 16:16:08 +09:00
Seonghyun Kim
22665e7ca2 Implement callable and call function in JNI layer
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-03-07 14:32:19 +09:00
Seonghyun Kim
8d4513054d Implement concurrent multithread support for java
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-03-07 14:32:19 +09:00
HyukWoo Park
22c8ca389e Fix minor code defects
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-03-06 15:22:53 +09:00
Seonghyun Kim
461cfab115 Reimplement JNI memory management
* 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>
2023-03-03 17:16:36 +09:00
Seonghyun Kim
e31f548e41 Add generate source and javadoc task in build.gradle
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-03-02 16:30:27 +09:00
Seonghyun Kim
e8ce2873b3 Implement GlobalObject and expose JSON.stringify, JSON.parse in JNI
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-03-02 16:30:27 +09:00
Seonghyun Kim
923edb3151 Implement ArrayObject api in JNI
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-03-02 16:30:27 +09:00
Seonghyun Kim
c995be8ca1 Implement basic Object api in JNI
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-03-02 10:00:12 +09:00
Seonghyun Kim
2894c6181d Update return type of Evaluator::evalScript in JNI
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-03-02 10:00:12 +09:00
Seonghyun Kim
54ad857db9 Implement more JavaScriptValue::to* methods in JNI
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-03-02 10:00:12 +09:00
Seonghyun Kim
3193067afa Update Bridge parameter and return type in JNI
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-03-02 10:00:12 +09:00
Seonghyun Kim
546163f6a8 Implement java version of Value::toString, equalsTo, instanceOf and Symbol
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-03-02 10:00:12 +09:00
Seonghyun Kim
3d1ddbaca3 Implement bundleHostJar on android build
* jar file tries to copy so file into /tmp/ folder

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-02-23 10:01:44 +09:00
Seonghyun Kim
3ff6946e45 Implement JavaScriptString class on jni layer
* rename Value into JavaScriptValue

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-02-23 10:01:44 +09:00
Seonghyun Kim
95ca57fc98 Implement running android(jni) test on host machine infra
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-02-22 11:55:59 +09:00
Seonghyun Kim
00a7ec1df2 Implement basic android api for undefined, null, number values
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-02-22 11:55:59 +09:00
Seonghyun Kim
97fde1d04f Allow multiple init, deinit to Globals
* Update android testcases

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-02-20 20:54:23 +09:00
HyukWoo Park
eaa51dc506 Add a cmake option for tizen-x64 build
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-02-17 11:44:45 +09:00
HyukWoo Park
b23f53065e Fix to cache AVD upon each architecture
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-02-02 22:16:31 +09:00
HyukWoo Park
86b792ebe3 Enable build for Mac OS
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-02-02 22:16:31 +09:00
Seonghyun Kim
8d328cedf0 Introduce NativePointerHolder on java and add java finalize method
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-02-02 09:56:25 +09:00
Seonghyun Kim
341c3fda5d We need to test both 32 and 64-bit on android
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-01-27 16:45:25 +09:00
Seonghyun Kim
f9246aa0b5 Add simple android API test and unit test & Update CI
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-01-27 16:45:25 +09:00
Seonghyun Kim
64f3f2e514 Implement simple Bridge Java with JavaScript
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-01-26 18:39:40 +09:00
Seonghyun Kim
dd8fc32ec1 Implement initial version of android API
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-01-26 18:39:40 +09:00
Seonghyun Kim
ad5f086f63 Update README.md and CI
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-01-25 19:20:45 +09:00
Seonghyun Kim
0b11603af4 Add android build artifact
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-01-25 19:20:45 +09:00
Seonghyun Kim
f94ad89e4f Tizen aarch64 should use 64BIT_LARGE mode
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-01-17 14:20:53 +09:00
HyukWoo Park
2b11f2f56c Update actions to newly run and test on arm architectures
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-01-17 13:03:18 +09:00
HyukWoo Park
52ef2a57d6 Fix a typo in ARM CPU macro
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-01-17 13:03:18 +09:00
HyukWoo Park
4c5a226df4 Fix a bug in virtual stack access
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-01-17 13:03:18 +09:00
HyukWoo Park
3dfdcb3afc Eliminate a redundant compiler flag
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-01-17 13:03:18 +09:00
Seonghyun Kim
6002bb00b6 Fix Android build properties & fix interpreter for clang
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-01-12 17:04:03 +09:00
Seonghyun Kim
ea81b6f8ee Update android build flags
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2023-01-09 16:15:17 +09:00
HyukWoo Park
f6fa45162f Resolve CMake deprecation warning
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-01-05 10:44:31 +09:00
HyukWoo Park
81bcf2ed13 Enable threaded interpreter for arm64 architecture
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-01-05 10:44:31 +09:00
HyukWoo Park
85f02cb647 Unify CI environments as to ubuntu-latest
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-01-05 10:44:31 +09:00
HyukWoo Park
8d7334ef4b Fix troubles in ubuntu-22.04 environment
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-01-04 10:26:08 +09:00
HyukWoo Park
581f020176 Fix code defects found by cppcheck
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-11-11 09:48:25 +09:00
HyukWoo Park
867b30ae17 Upgrade actions version
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-11-11 09:46:53 +09:00
Csizi Gergő Lajos
8e1ea20583 Fix some Temporal issues
Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2022-10-31 12:09:03 +09:00
Seonghyun Kim
ea0c2c4c82 Reduce ObjectStructure memory usage
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-10-28 09:46:07 +09:00
HyukWoo Park
cb31d43274 Fix minor defects
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-10-24 10:51:24 +09:00
HyukWoo Park
7049e81782 Fix test262 runner to print full result
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-10-11 11:25:32 +09:00
Csizi Gergő Lajos
837ced6e3e Add Addition and Subtraction operations for TemporalObjects
Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2022-10-11 11:13:49 +09:00
Zoltan Herczeg
bd20dbf916 Rework plain date and time constructors
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-10-07 16:56:39 +09:00
HyukWoo Park
d7b08b00db Update ArrayBuffer with auto length
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-09-29 11:57:58 +09:00
Seonghyun Kim
15db6c3c2e Update Identifier parsing rule regarding to unicode 14 & fix parser bug
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-09-29 10:43:21 +09:00
Seonghyun Kim
87c8a581bd Remove useless peekChar calling in Lexer::lex
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-09-29 10:43:21 +09:00
Zoltan Herczeg
135ee35c54 Pass optimization flags to wabt in release
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-09-29 10:42:35 +09:00
Seonghyun Kim
d698343196 Remove busy waiting & fix memory bug
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-09-29 10:34:59 +09:00
Seonghyun Kim
682f176d6d Implement Atomics.waitAsync
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-09-29 10:34:59 +09:00
Zoltan Herczeg
c1b02c23e0 Support dynamic import of JSON modules
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-09-29 10:33:58 +09:00
Gergo Csizi
920be3b9d0 Add TemporalZonedDateTime object
Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2022-09-23 10:16:15 +09:00
HyukWoo Park
90e3e6f474 Remove wrong assertions in Temporal
* this value could be a Value other than Object in Temporal builtin functions

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-09-19 13:14:52 +09:00
HyukWoo Park
dcd7179b09 Update test262 to the latest version
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-09-19 13:14:52 +09:00
Seonghyun Kim
693dcf114c Implement PrivateIdentifier in ... expression
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-09-16 14:39:58 +09:00
HyukWoo Park
2f634771af Refactor BufferAddressObserver
* remove redundant slots
* rename observer callback

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-09-15 15:24:58 +09:00
Seonghyun Kim
24d80757bd Update byteLength and arrayLength of TypedArrayObject when ArrayObject.prototype.resize is called
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-09-14 18:28:03 +09:00
HyukWoo Park
7d59581294 Fix wrong code in Array.prototype.at
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-09-14 11:07:48 +09:00
HyukWoo Park
a1698590b3 Fix minor defects
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-09-14 11:07:48 +09:00
Zoltan Herczeg
3a0b874a7e Implement JSON module parsing
Currently only the import statement is supported

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-09-13 16:46:36 +09:00
Seonghyun Kim
b992df9a06 Fix wrong assert in JSGetterSetter
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-09-07 18:38:50 +09:00
Zoltan Herczeg
fd81fa4e52 Support more class static initializer features
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-08-31 14:53:28 +09:00
Gergo Csizi
7852ed629b Add TemporalTimeZone object
Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2022-08-31 14:53:06 +09:00
Zoltan Herczeg
afa8f4aecc Move JSON parse / stringify operations into runtime
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-08-30 17:46:11 +09:00
Seonghyun Kim
6f9f2d1f5d When parsing function parameter with pattern,
we should update isAssignmentTarget variable.

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-08-30 17:45:31 +09:00
Zoltan Herczeg
289c3bdabb Reduce keyword comparisons in the parser
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-08-30 11:02:52 +09:00
Zoltan Herczeg
1a5414a0ba Support class static initializers
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-08-22 15:21:50 +09:00
Gergo Csizi
a7ddbe9eb5 Rename Temporal classes and simplify code
Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2022-08-17 15:35:29 +09:00
Gergo Csizi
2cadeba54c Add TemporalPlainMonthDay object
Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2022-08-12 11:31:18 +09:00
Gergo Csizi
17b089db85 Add TemporalInstant object
Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2022-08-10 15:09:10 +09:00
Gergo Csizi
d055deea48 Add TemporalPlainYearMonth object
Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2022-08-08 16:24:55 +09:00
HyukWoo Park
d2a17f09cd Update finalizer with shrink function
* 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>
2022-08-03 16:40:35 +09:00
Zoltan Herczeg
c3dbe442ef Further reduce string comparisons in the parser
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-08-01 15:23:13 +09:00
HyukWoo Park
bf1ff52089 Fix finalizer to prevent any possible memory defect
* 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
2022-08-01 13:28:00 +09:00
HyukWoo Park
b700d08424 Fix TypedArray access
* clearly declare each GC member of ArrayBuffer
* add detached buffer check in TypedArray access

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-08-01 13:28:00 +09:00
HyukWoo Park
3d7729c96b Fix a minor memory access defect
* 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>
2022-08-01 13:28:00 +09:00
HyukWoo Park
5eca40faec Change BigInt operations as to constant functions
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-08-01 13:26:41 +09:00
HyukWoo Park
13adaf9ad6 Fix gcc warning about strict-aliasing
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-07-27 16:01:53 +09:00
Zoltan Herczeg
b476b72ea2 Improve keyword handling in the parser
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-07-27 16:01:28 +09:00
HyukWoo Park
a2bcfd2e9b Replace character string with basic AtomicString
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-07-27 16:00:09 +09:00
HyukWoo Park
b165161ae8 Update the version of ICU in CI
* update the ICU version to 70 because previous 67 version has been deleted in archive

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-07-27 15:59:14 +09:00
Gergo Csizi
2103db26e9 Fix some Temporal issues
Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2022-07-19 16:46:50 +09:00
HyukWoo Park
8b8c13db7d Remove unnecessary bytecode generation in callee initialization
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-07-15 15:31:37 +09:00
HyukWoo Park
79c3b4c73f Fix a bug in explicitly declared funtion name with exception case
* remove a redundant bytecode addition in node line info calculation

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-07-15 15:31:37 +09:00
Gergo Csizi
da449c8797 Add TemporalDuration
Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2022-07-12 11:11:00 +09:00
Seonghyun Kim
65baa3944e Fix parsing async arrow function bug
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-06-30 11:29:39 +09:00
HyukWoo Park
bb350fc8fd Remove a redundant cmake flag
* DEBUGGER flag removed

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-06-29 19:51:33 +09:00
Gergo Csizi
2806a898f2 Add TemporalPlainTime
Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2022-06-27 13:27:49 +09:00
Zoltan Herczeg
28817212d7 Improve the text of wait before exit
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-06-27 13:26:33 +09:00
HyukWoo Park
3bdf67dc83 Update WebAssembly engine version
* update wabt to v1.0.29

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-06-24 11:09:53 +09:00
Gergo Csizi
d21dde719c Rewrite the ISO8601 parser
The previous parser implementation didn't parse valid ISO8601 strings.

Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2022-06-24 11:09:23 +09:00
HyukWoo Park
f23646ca1b Fix debugger to match with the updated vscode extension
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-06-24 11:09:13 +09:00
HyukWoo Park
944d244e0a Add code owner
* add @zherczeg as a code owner of debugger

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-06-24 11:09:13 +09:00
Seonghyun Kim
e7b1cb2dde Revise FillOpcodeTable operation by using inline asm label.
we can remove one if-statement in interpreter through this commit.

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-06-24 10:32:13 +09:00
Seonghyun Kim
2678a383ec Improve dealing way of program counter in interpreter
* 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>
2022-06-24 10:32:13 +09:00
Gergo Csizi
2e2b6a8398 Add getters for PlainDate, PlainDateTime and Calendar
Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2022-06-17 13:28:51 +09:00
HyukWoo Park
430006301b Fix minor defects
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-06-15 09:36:32 +09:00
Seonghyun Kim
93a0e853fe Implement inline cache version of get object opcode. Replace the opcode in runtime.
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-06-15 09:36:00 +09:00
Seonghyun Kim
633df26291 Reduce sizeof GetObjectPreComputedCase by 1-word
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-06-15 09:36:00 +09:00
Gergo Csizi
0980c57817 Add TemporalPlainDateTime, TemporalPlainDate objects
Basic implementation of TemporalPlainDateTime, TemporalPlainDate.

Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2022-05-27 14:57:22 +09:00
Zoltan Herczeg
ae893f84c6 Support eval code debugging
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-05-27 14:57:08 +09:00
Seonghyun Kim
25771515ff Merge Equals, NotEquals binary opcodes into one opcode
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-05-27 09:54:04 +09:00
HyukWoo Park
f486922d87 Remove redundant string allocation in debugger
* 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>
2022-05-23 16:02:45 +09:00
HyukWoo Park
488de00180 Directly insert properties for builtin objects
* replace defineOwnProperty with directDefineOwnProperty method
* directly insert new properties for builtin objects

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-05-23 16:02:33 +09:00
Seonghyun Kim
3a5f883ad4 Allow to save Int32 convertible double value as double in Value for performance
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-05-23 16:02:20 +09:00
Seonghyun Kim
2737ccd987 Update Value constructors
Improve Value::Value(double) performance.
Add missing double and int32 type testing on interpreter

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-05-23 16:02:20 +09:00
HyukWoo Park
ebd5a42641 Fix backtrace info within eval code
* collect backtrace info including eval codes

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-05-20 08:44:14 +09:00
Zoltan Herczeg
de7aae0eba Support WebSocket close
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-05-20 08:43:32 +09:00
HyukWoo Park
786cb68d27 Fix the type of prototype in Temporal
* 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>
2022-05-11 15:59:43 +09:00
HyukWoo Park
8fa6031fec Add DerivedObject for sub classes of Object
* 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>
2022-05-11 15:59:43 +09:00
Gergo Csizi
1763b6f38d Add Temporal JavaScript feature
Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2022-05-06 19:58:51 +09:00
Seonghyun Kim
04eb482d1e Add Object::constructorName API
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-05-03 19:05:38 +09:00
Seonghyun Kim
3d7bbe9c6a Update function name & init member variables in debug mode
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-05-03 18:47:43 +09:00
Seonghyun Kim
4ed055e82c Add special method for add property in object what was not existent.
the new method not check the existent of proeprty.
it can used for builtin-functions

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-05-03 18:47:43 +09:00
Seonghyun Kim
64403a2ea2 Implement get fast source, flags proeprty for RegExpObject
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-05-03 18:47:43 +09:00
Seonghyun Kim
f61cf477f4 Improve yarr performance
* 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>
2022-05-03 18:47:43 +09:00
Gergo Csizi
856a1e2045 Show information about new generated test262 excludelist
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
2022-04-29 17:03:03 +09:00
HyukWoo Park
0f034c7f0b Mark non-fast mode ArrayObject by existing fast-mode data
* 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>
2022-04-25 10:47:32 +09:00
HyukWoo Park
d231bc0800 Rename tagging operations
* 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>
2022-04-22 16:11:56 +09:00
HyukWoo Park
de11a8a032 Fix uninitialized address usage in StringBuilder
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-04-22 16:11:56 +09:00
Seonghyun Kim
4cec2cda5a Remove useless comment
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-04-22 16:11:23 +09:00
Seonghyun Kim
83e4254ed0 Fix bug in Vector
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-04-22 16:11:23 +09:00
Seonghyun Kim
8eb836f60d TypedArrayObject should have raw buffer directly.
For achieve it, I add BufferAddressObserverManager.

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-04-22 16:11:23 +09:00
Seonghyun Kim
71a6afeaae Improve accessing TypedArray Performance
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>
2022-04-22 16:11:23 +09:00
HyukWoo Park
467ca4708f Fix minor debugger error
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-04-20 17:18:47 +09:00
HyukWoo Park
48b59453c6 Handle getting of undefined value by simple literal loading
* undefined value is obtained through GlobalVariableGet bytecode
* convert this case into simple LoadLiteral bytecode

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-04-19 13:37:13 +09:00
HyukWoo Park
9f901623dd Enable first breakpoint for Script created by initializeFunctionScript
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-04-18 17:19:19 +09:00
HyukWoo Park
02aac43bcf Minor fix for debugger
* 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>
2022-04-18 17:19:19 +09:00
Seonghyun Kim
705b959d3f Remove useless ObjectRareData allocation in RegExpObject
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-04-18 17:15:36 +09:00
Seonghyun Kim
292ead9d73 Implement checking update ArrayObject while enumerate
We can find disappered index without using the flag

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-04-18 17:15:36 +09:00
Seonghyun Kim
ba7c596e59 Implement PrototypeObject
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>
2022-04-18 17:15:36 +09:00
HyukWoo Park
ab86e7137c Fix wrong node position in switch statement
* 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>
2022-04-18 17:13:58 +09:00
Zoltan Herczeg
03c8cf55e2 Fix tcp connection available check in the debugger
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-04-14 16:38:11 +09:00
HyukWoo Park
a25c6fa5e8 Add a specific API to create a Script by wrapping the source code with an anonymous function
* `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>
2022-04-14 10:57:47 +09:00
HyukWoo Park
d3f6ef74f9 Add ErrorThrowCallback API
* ErrorThrowCallback is invoked when an Error is thrown
* ErrorThrowCallback overwrites the result of ErrorCreationCallback

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-04-13 15:22:59 +09:00
Zoltan Herczeg
49c40cd26e Implement object store in the debugger
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-04-12 14:13:56 +09:00
Seonghyun Kim
35c6836f2e Divide get object inline cache into 2 case
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>
2022-04-12 12:01:08 +09:00
Seonghyun Kim
18707ead9e Store Value instead of dobule in NumberInEncodedValue.
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>
2022-04-12 11:35:25 +09:00
Seonghyun Kim
f4d0b2c940 Improve array get, set performance in interpreter
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-04-08 10:26:23 +09:00
Seonghyun Kim
9eab9b21f4 Cache data address of ArrayBuffer for improve performance
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-04-08 10:26:23 +09:00
HyukWoo Park
09c78e357d Fix a minor bug in DoubleInEncodedValue conversion
* 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>
2022-04-08 10:25:12 +09:00
HyukWoo Park
160c6b3183 Update fast construct method for ScriptSimpleFunctionObject
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-04-06 09:55:14 +09:00
HyukWoo Park
d0716850af Rename required register numbers for ByteCodeBlock
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-04-06 09:55:14 +09:00
HyukWoo Park
2593b3cabe Do not notify bytecode release for debugging-unmarked function
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-04-05 11:19:46 +09:00
Seonghyun Kim
45eaf29c4c Reimplement object set inline cache to store multiple item of inline cache
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-04-05 11:18:18 +09:00
Seonghyun Kim
e6ff2808c8 Fix get object inline cache bug
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>
2022-04-05 11:18:18 +09:00
Seonghyun Kim
635c609330 Refactor DoubleInEncodedValue
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>
2022-03-31 14:30:42 +09:00
Zoltan Herczeg
21d0e6aa42 Implement scope chain property enumeration in the debugger
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-03-28 17:15:34 +09:00
Seonghyun Kim
9be98a8082 Improve Value <-> EncodedValue conversion performance
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-03-28 14:39:52 +09:00
Seonghyun Kim
ebf4756480 Binding function object in interpreter and compute required stack size early
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-03-28 14:39:52 +09:00
Seonghyun Kim
b76294bcca Init local stack allocated var values in interpreter
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-03-28 14:39:52 +09:00
HyukWoo Park
a84b75d407 Update ErrorCreationCallback handling to ignore adding stackdata into stack property
* 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>
2022-03-28 10:38:47 +09:00
HyukWoo Park
de9c7cefd9 Mark String::emptyString as source of AtomicString
* 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>
2022-03-28 10:36:37 +09:00
HyukWoo Park
1b38eeca32 Update Debugger to selectively generate debugging byte codes
* 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>
2022-03-25 17:41:23 +09:00
Seonghyun Kim
c9f14d2a87 Implement ScriptSimpleFunctionObject for enhance function call performance
many general function can use ScriptSimpleFunctionObject.
It has simple call operation

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-03-23 10:53:36 +09:00
HyukWoo Park
8ed787168c Minor fix in Promise reject callback
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-03-23 10:53:04 +09:00
Seonghyun Kim
91223b79ab Fix symbol lookup error on FunctionTemplate
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-03-21 09:00:40 +09:00
HyukWoo Park
2c83b022f3 Update PromiseRejectCallback for PromiseHandlerAddedAfterReject event
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-03-16 14:46:39 +09:00
Seonghyun Kim
5d984c935c Implement fast path of get symbol from object.
the path is used on Value::instanceOf and Value::toPrimitiveSlowCase

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-03-16 14:46:17 +09:00
Seonghyun Kim
6d5a1ce7ac Revise object get inline cache
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-03-14 14:32:57 +09:00
Seonghyun Kim
f79a169daa Improve enumerate performance
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-03-14 14:32:57 +09:00
Seonghyun Kim
a484082e44 Reduce memory usage
* 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>
2022-03-14 14:32:57 +09:00
Boram Bae
ada969cc24 Improve object enumeration performance
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2022-03-11 13:59:14 +09:00
HyukWoo Park
716ff17dd7 Update PromiseRejectCallback
* 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>
2022-03-10 15:35:36 +09:00
Seonghyun Kim
9a1060f48c Refactor basic String classes
* 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>
2022-03-08 16:27:33 +09:00
HyukWoo Park
ac6b7106b9 Optimize string comparison with typeof operation
* insert AtomicString for typeof strings by parser
* refactoring equal operations

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-03-07 13:35:51 +09:00
HyukWoo Park
47530e7ebb Optimize Object::getPrototypeFromConstructor for function case
* quickly get `prototype` property of function object

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-03-07 13:34:21 +09:00
Boram Bae
006c9e91a0 Use memset instead of loop
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2022-03-07 13:34:02 +09:00
Boram Bae
3d83a5fd47 Use original desc if this and receiver are same
* This way you can reduce the getOwnProperty calls.

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2022-03-03 18:16:30 +09:00
Seonghyun Kim
e245fe2871 Implement InlineCache in Object initialize
* Prevent too many recursive call with RopeString::charAt
* Add option to configure ObjectStructure

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-03-03 15:31:38 +09:00
Boram Bae
9beb788245 Update based on review
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2022-03-02 14:49:49 +09:00
Boram Bae
97ba88bc86 Use arrayLength for length property if possible
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2022-03-02 14:49:49 +09:00
Seonghyun Kim
4d69bed6c5 Improve performance little
* 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>
2022-03-02 14:48:18 +09:00
Seonghyun Kim
925543bc15 Turn on inline cache for array, arguments object
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-02-23 13:47:03 +09:00
Boram Bae
9367246301 Use a static string If a char belongs to ASCII
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2022-02-23 13:38:57 +09:00
HyukWoo Park
ea5c495733 Optimize enumeration of object without index property case
* 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>
2022-02-22 20:02:15 +09:00
Gergo Csizi
38ec2cbefa Fix crash in the debugger
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
2022-02-22 10:06:56 +09:00
HyukWoo Park
375e2b7dc2 Update version of WASM engine
* 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>
2022-02-22 10:06:37 +09:00
HyukWoo Park
f6eeb2c1fc Fix source name to always have valid string value
* set empty string for no name case

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-02-08 18:54:32 +09:00
Zoltan Herczeg
92a8db40c8 Implement scope chain retrieval
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-02-08 18:53:38 +09:00
Gergo Csizi
bc02ddc1fa clean up the debugger
Removed unnecessary semicolons and brackets.

Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2022-01-28 10:25:24 +09:00
Gergo Csizi
64b0d56ccb Migrate the debugger from python2 to python3
Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2022-01-27 11:28:55 +09:00
Seonghyun Kim
8fc73a6e13 Update script module API
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-01-21 10:19:49 +09:00
Gergo Csizi
3a20bde083 Remove unused exception argument from debugger
Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2022-01-19 21:12:34 +09:00
HyukWoo Park
ba540cd129 Remove redundant structures in stack tracing
* stack trace vector does not need to hold ExecutionState vector

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-01-18 15:28:21 +09:00
HyukWoo Park
913bcc7882 Rename StackTrace structures
* to clearly distinguish StackTraceData and StackTraceDataVector

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-01-18 15:28:21 +09:00
Gergo Csizi
4bbd9d6cc6 Add breakpoint at the end of script execution
With --wait-before-exit it can be turned on in the debugger-server or in the debugger-client.

Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2022-01-18 15:27:35 +09:00
HyukWoo Park
bd35e41168 Add setName API of FunctionObject
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-01-13 13:24:09 +09:00
HyukWoo Park
ba1021cc14 Re-align property order of FunctionTemplete according to FunctionObject property order
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-01-13 13:24:09 +09:00
SeongHyun Kim
0af32fafde Implement build for Windows UWP
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-01-12 13:44:04 +09:00
HyukWoo Park
f0b058ec5b Fix ByteCodeBlock nullify in gc callback
* we need to reset ByteCodeBlock only for normal functions
* add assertion to check invalid operation

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-01-11 17:31:48 +09:00
Seonghyun Kim
067d3c4d86 Fix crash with using let, for and {break or continue} together
m_complexJumpContinueIgnoreCount, m_complexJumpBreakIgnoreCount are
should follow size of m_recursiveStatementStack

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-01-05 13:36:36 +09:00
Seonghyun Kim
b1b505ae42 disable gc while calling Object finalizer 2022-01-05 13:36:36 +09:00
Zoltan Herczeg
a80e5f285c Implement eval in debugger
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-01-03 17:07:48 +09:00
HyukWoo Park
e2758f5a2c Add createFunction API with source name parameter
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-01-03 11:28:48 +09:00
Seonghyun Kim
400507c0f3 Treat parsingEnabled flag in Debugger correctly
* 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>
2021-12-29 15:58:08 +09:00
Seonghyun Kim
f44b380f16 Implement --accept-timeout option on DebuggerRemote
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-12-29 15:58:08 +09:00
Seonghyun Kim
de02b5453f Add callee into StackTraceData
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-12-28 10:31:15 +09:00
Zoltan Herczeg
8ba5e690cb Implement backtrace getting in the Debugger API
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-12-21 17:27:21 +09:00
Seonghyun Kim
ba1393c8e1 Add InlineStorage for FunctionEnvironmentRecordOnHeap
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>
2021-12-20 18:04:35 +09:00
HyukWoo Park
c7c7320f5a Add reference counter in ReloadableString
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-12-16 13:32:46 +09:00
HyukWoo Park
5e8524bf8b Add reference counter in CompressibleString
* 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>
2021-12-16 13:32:46 +09:00
Zoltan Herczeg
8d584f10a0 Implement stop at breakpoint in C-API debugger
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-12-16 10:59:47 +09:00
Zoltan Herczeg
a481cd6dd8 Start creating a debugger API
- The debugger callbacks are implemented as class
- Using std::vector for storing data

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-12-10 16:46:22 +09:00
Seonghyun Kim
e99603ae66 Remove defines from EscargotPublic.h
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-12-10 12:46:07 +09:00
Seonghyun Kim
faf8db179c Fix error in DebuggerTcp::isThereAnyEvent
if there is remained receive buffer data,
user should call receive function again

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-12-10 12:45:32 +09:00
HyukWoo Park
8c51b7c9a6 Fix bugs in debugger
* 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>
2021-12-03 11:57:22 +09:00
Gergo Csizi
eb509d32bd Fix delete operation in the debugger
The delete operation did not work with breakpoint index.

Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2021-12-01 17:07:34 +09:00
Gergo Csizi
45675c8b0b Add --command argument for the debugger
--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
2021-12-01 16:50:16 +09:00
HyukWoo Park
f68ca49933 Implement SharedArrayBuffer.prototype.grow builtin method
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-11-29 10:38:11 +09:00
Seonghyun Kim
3e6afe1c50 Improve debugger function
* 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>
2021-11-26 15:11:49 +09:00
HyukWoo Park
01f988160a Fix slow test run in actions
* exclude octane test for small configuration due to low performance

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-11-26 14:23:49 +09:00
Zoltan Herczeg
56157aaa74 Simplify the parsing API of the debugger.
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-11-26 14:00:03 +09:00
Gergo Csizi
ff2c8073b7 Fix crash in debugger
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
2021-11-25 14:27:09 +09:00
Zoltan Herczeg
d79eb6f9e1 Hide debugger enabled from public use.
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-11-23 16:51:06 +09:00
Zoltan Herczeg
e3b1a9f5e6 Introduce abstract base class for debugger
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-11-23 10:52:17 +09:00
HyukWoo Park
12c91f055c Fix atomic operations
* 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>
2021-11-22 15:02:25 +09:00
Gergo Csizi
9f0574a8bd Add p command for the debugger
Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2021-11-22 10:14:30 +09:00
HyukWoo Park
ab15bd5574 Implement setIndexedPropertyHandler for ObjectTemplate
* rename data related to PropertyHandler
* refactoring ObjectWithPropertyHandler to handle NamedProperty and IndexedProperty both
* add cctest

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-11-17 17:22:35 +09:00
HyukWoo Park
fa052c8902 Refactoring ObjectTemplate's PropertyHandler
* 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>
2021-11-17 17:22:35 +09:00
Zoltan Herczeg
67131c43cd Fix execution resume after setting a breakpoint.
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-11-15 12:02:37 +09:00
HyukWoo Park
5784b5096d Implement getter built-in methods of growable SharedArrayBuffer
* implement internal resizable sharedarray data
* update growable and maxByteLength getter builtin methods

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-11-11 15:20:43 +09:00
HyukWoo Park
de48b644dc Update test262 testsuite version
* update test262 to the latest version (commit id: 1ad9bb)

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-11-11 15:20:43 +09:00
HyukWoo Park
ba8b499800 Trivial defect fix
* replace toPropertyKey with ObjectPropertyName constructor
* remove unused MetaNode in parsing

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-11-11 09:44:00 +09:00
Mate Dabis
7b400aa58f Fix python version for escargot debugger
Signed-off-by: Mate Dabis <mdabis@inf.u-szeged.hu>
2021-11-10 14:53:11 +09:00
HyukWoo Park
c295ee69e1 Refactoring createFunctionSourceFromScriptSource
* use memcpy for string merging
* remove unused functions

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-11-10 14:52:54 +09:00
HyukWoo Park
239e0683f8 Enable created function's format check only for non-reloadable string in test mode
* 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>
2021-11-10 14:52:54 +09:00
Mate Dabis
a5035c4ad8 Fix argument checking for b (break) command in python debugger
Signed-off-by: Mate Dabis <mdabis@inf.u-szeged.hu>
2021-11-10 14:52:11 +09:00
HyukWoo Park
f47def1f22 Replace TemplatePropertyName with existing ObjectStructurePropertyName
* 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>
2021-11-10 14:51:47 +09:00
HyukWoo Park
30f3b3a348 Revise createFunctionSourceFromScriptSource
* 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>
2021-11-01 17:03:58 +09:00
Seonghyun Kim
8986e222f4 Fix compile error on gcc version 5
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>
2021-10-29 12:38:57 +09:00
HyukWoo Park
4366a01196 Update customized logging
* 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>
2021-10-29 12:30:46 +09:00
HyukWoo Park
78b1aa7d2e Update lint checker to include cctest file
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-10-29 12:30:32 +09:00
HyukWoo Park
18449ff9a6 Implement resizable ArrayBuffer
* update some new features of resizable ArrayBuffer

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-10-29 12:30:32 +09:00
SeongHyun Kim
c1a5a53bb7 Mark enum as unsigned
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>
2021-10-28 12:21:12 +09:00
SeongHyun Kim
110359e4db Update source & build files for windows
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
Signed-off-by: SeongHyun Kim <sh8281.kim@samsung.com>
2021-10-25 18:48:10 +09:00
Seonghyun Kim
eeb15679c5 we should reset firstCoverInitializedNameError when skipping arrow function in parser
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-10-25 13:55:02 +09:00
Mate Dabis
5530392636 Fix argument checking for object command in python debugger
JerryScript-DCO-1.0-Signed-off-by: Mate Dabis mdabis@inf.u-szeged.hu
2021-10-21 13:13:46 +09:00
HyukWoo Park
01d6ed1047 Fix Template to inherit parent's NativeDataAccessorProperties
* according to api, ObjectTemplate should inherit its parent's NativeDataAccessorProperties of InstanceTemplate too

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-10-18 15:16:25 +09:00
Seonghyun Kim
848873c6c7 Implement special case for Function constructor with ReloadableString
* Add new api for Function::create

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-10-18 13:34:28 +09:00
Seonghyun Kim
765ccac4d7 Fix compile error in release mode with debugger
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-10-18 13:34:28 +09:00
HyukWoo Park
711d75f500 Fix minor defects
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-10-14 18:37:06 +09:00
Seonghyun Kim
b6b0c9a1b6 We should notify what length means stringLength or bufferLength
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-10-14 18:30:52 +09:00
Seonghyun Kim
1091bcecd9 Cache of lastBreakpointInfo in ByteCodeGenerator is not always advancing
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-10-14 18:30:52 +09:00
Ryan Hyun Choi
e479b456a9 Fix SharedArrayBuffer's create()
* Enable threading in api-test
* Add a SharedArrayBuffer test

Signed-off-by: Ryan Choi <ryan.choi@samsung.com>
2021-10-14 16:43:10 +09:00
Zoltan Herczeg
c2ab3e1f3d Implement backtrace recording for Promise.then calls
Furthermore rework detection of recorded backtrace.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-10-12 12:32:49 +09:00
HyukWoo Park
9f156c6dc6 Fix minor gcc build errors
* 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>
2021-10-08 16:46:59 +09:00
HyukWoo Park
aef7ba0c98 Update GC event callback registration
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-10-07 08:39:04 +09:00
Zoltan Herczeg
1dff039743 Implement backtrace recording for the debugger
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-10-06 11:43:19 +09:00
Seonghyun Kim
a30b318b4a Implement GenericIteratorObject
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-09-29 16:15:21 +09:00
HyukWoo Park
d369ca50b0 Fix clang build errors
* fix some tiny errors in wasm
* update wasm version to 1.0.24
* run tidy check in actions

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-09-29 14:35:44 +09:00
Seonghyun Kim
458d7a2e4c Remove useless global variables in Intl
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-09-27 16:40:21 +09:00
Seonghyun Kim
5185932e6d Implement Intl.ListFormat
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-09-27 16:40:21 +09:00
Seonghyun Kim
988492a339 Add toStringTag into Intl Object
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-09-27 16:40:21 +09:00
HyukWoo Park
659745ceed Store function name value correctly to access it in inner function scope
* 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>
2021-09-27 16:38:22 +09:00
HyukWoo Park
843f4af78e Assign source name for dynamically created functions
* get source name through outer lexical scope

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-09-27 16:37:12 +09:00
HyukWoo Park
faa56e648d Fix typo about gotException in ModuleExecutionResult
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-09-27 16:37:12 +09:00
HyukWoo Park
07c91a33e6 Add callback for Error creation
* registered callback is triggered for each Error constructor call

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-09-14 16:39:15 +09:00
HyukWoo Park
f864d828fb Refactoring BackingStore structure
* divide BackingStore structure into NonShared and Shared
* update BackingStoreRef API to clarify its usage

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-09-14 15:54:17 +09:00
HyukWoo Park
1a258a0635 Add SharedArrayBufferObject create api
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-09-14 15:54:17 +09:00
Seonghyun Kim
d1658fd41b Some platforms have restriction of typed-malloc maximum size.
for reducing size, I move ascii table and number table into native heap area.

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-09-13 10:22:27 +09:00
Seonghyun Kim
5b362cf5b9 Implement newly added function of Intl.Locale
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-09-13 10:22:27 +09:00
Seonghyun Kim
e8426a8a4f Refactor: Remove duplicated code with macro
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-09-13 10:22:27 +09:00
Seonghyun Kim
acf49742d1 Fix Symbol of Intl.PluralRules
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-09-13 10:22:27 +09:00
Seonghyun Kim
7692878218 Add try-catch-finally condition variable into ExecutionState
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-09-09 15:17:12 +09:00
Seonghyun Kim
131e05f2ed Implement Intl.DisplayNames.prototype.of function
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-09-09 09:41:01 +09:00
Seonghyun Kim
155d9b6e95 Implement constructor and getResolvedOptions of Intl.DisplayNames
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-09-09 09:41:01 +09:00
Zoltan Herczeg
4ec34f2685 Initial debugger documentation
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-09-08 18:09:48 +09:00
Zoltan Herczeg
ed55d51384 Support default class constructors in the debugger
These functions have no source code and should be ignored by the debugger

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-09-03 17:05:32 +09:00
HyukWoo Park
81bae461df Handle BigInt type in CreateListFromArrayLike method
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-09-03 12:55:47 +09:00
HyukWoo Park
0ee0e3ae36 Fix to c++ style casting in ByteCode
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-09-03 11:03:56 +09:00
HyukWoo Park
d925600bf2 Refactoring ByteCode dump
* 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>
2021-09-03 11:03:56 +09:00
HyukWoo Park
9e15a05497 Fix minor defects
* remove unused variable
* clarify math calculation in NumberObject

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-09-03 11:03:56 +09:00
Seonghyun Kim
d25c251c93 Implement basic of new IntlDateTimeFormat
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-09-01 16:37:54 +09:00
Seonghyun Kim
5f6b42c5bc Update locale info
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-09-01 16:37:54 +09:00
Seonghyun Kim
11ab2b42f6 Update AsyncFromSyncIteratorPrototype functions because spec is updated
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-09-01 16:37:54 +09:00
HyukWoo Park
54fadc4ff8 Remove redundant defineOwnPropertyThrowsExceptionWhenStrictMode method
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-08-30 10:00:12 +09:00
HyukWoo Park
d6eb9fec6f Update Error cause
* https://tc39.es/proposal-error-cause

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-08-30 10:00:12 +09:00
HyukWoo Park
98ec4e5cab Implement TypedArray.prototype.findLast and TypedArray.prototype.findLastIndex
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-08-25 11:19:36 +09:00
Zoltan Herczeg
ff4d4d593d Add debugger test cases for class fields
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-08-24 15:26:23 +09:00
HyukWoo Park
b1aec3b7b9 Implement Object.hasOwn property
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-08-24 12:30:55 +09:00
Seonghyun Kim
a07fe9ed1e Use Function's Context when throw exception
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-08-18 15:04:09 +09:00
Seonghyun Kim
8d63665e28 Implement Array.prototype.findLast, findLastIndex
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-08-18 15:04:09 +09:00
Seonghyun Kim
8a51147dc9 Update test262 test suite
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-08-18 15:04:09 +09:00
HyukWoo Park
90e70b4e91 Add omitted source info in ExecutionStateRef::computeStackTraceData
* add source name and source code info to Evaluator::StackTraceData

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-08-17 20:04:32 +09:00
Seonghyun Kim
19298e2216 Implement Atomics.wait, notify
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-08-17 20:03:39 +09:00
Seonghyun Kim
f85efad8da Implement Atomics.isLockfree
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-08-17 20:03:39 +09:00
HyukWoo Park
a2d15f4e66 Add build target for x86_64
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-08-17 13:15:07 +09:00
HyukWoo Park
0d65ad5e3d Implement lazy builtin initialization
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-08-12 13:43:23 +09:00
Seonghyun Kim
7b77fcd4cd If object has native data accessor with actsLikeJS is true, the object should be non inline cacheable
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-08-11 15:28:35 +09:00
Seonghyun Kim
bd45251b5d If there is a argument with default value, function length should not increase after the argument
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-08-06 13:18:50 +09:00
HyukWoo Park
a91417a38c Reorganize builtin and Intl source files
* make builtins and intl directory

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-08-06 13:16:58 +09:00
HyukWoo Park
06e954de18 Fix build error and warning
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-08-05 13:29:02 +09:00
Seonghyun Kim
207b6b4fbd Implement atomic operation in Atomics builtins
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-08-05 13:28:08 +09:00
Seonghyun Kim
dd97c866f4 Implement ArrayBuffer type for divide ArrayBufferObject and SharedArrayBufferObject
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-08-02 14:23:06 +09:00
HyukWoo Park
a39423acb7 Revise CMake build script
* 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>
2021-07-30 11:28:52 +09:00
HyukWoo Park
afa76c5f68 Fix build warnings of WebAssembly build
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-07-30 11:28:52 +09:00
HyukWoo Park
84451fd28e Add setLength method to FunctionTemplate
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-07-29 13:37:54 +09:00
Seonghyun Kim
dbae3ae8fe Implement Serialization of SharedArrayBufferObject & $262.agent.* functions for testing
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-07-29 13:36:15 +09:00
HyukWoo Park
13c774e49f Add ThreadLocal structure
* 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>
2021-07-27 16:40:08 +09:00
HyukWoo Park
98bc107937 Add Global object shared by all threads
* Platform is also managed in Global object
* Global has life time same to program

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-07-27 16:40:08 +09:00
Seonghyun Kim
52d51d976e Implement serializing of Symbol and BigInt
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-07-27 15:29:24 +09:00
Seonghyun Kim
dff3ddd475 Add new api test related with Serializing Symbol, BigInt
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-07-27 15:29:24 +09:00
Seonghyun Kim
2d77fbd81f Implement simple Value serialization
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-07-27 15:29:24 +09:00
Seonghyun Kim
878e911e7d Implement value Serializer test
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-07-27 15:29:24 +09:00
Seonghyun Kim
5c3f60aa47 Add functions what return version info and configure info into Globals class
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-07-27 15:29:24 +09:00
HyukWoo Park
703c0edecc Update PromiseHook for Promise API
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-07-21 15:17:06 +09:00
Seonghyun Kim
77a68579a5 Implement per thread isolating
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-07-15 17:47:41 +09:00
HyukWoo Park
ac2bb84b6f Update PromiseHook
* 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>
2021-07-15 10:54:18 +09:00
Seonghyun Kim
f43d845975 Implement BackingStore::reallocate
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-07-08 16:38:00 +09:00
HyukWoo Park
f2fd751c1e Fix EncodedSmallValue encoding
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-07-08 15:31:21 +09:00
Seonghyun Kim
76fa95cad6 Implement AssignmentTargetType spec
https://tc39.es/ecma262/#sec-static-semantics-assignmenttargettype

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-07-07 10:02:16 +09:00
Seonghyun Kim
133f76ade6 We should throw SyntaxError when there is escaped reserved keyword in strict mode
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-07-07 10:02:16 +09:00
HyukWoo Park
4709a66250 Update Atomics compareExchange and exchange method
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-07-06 12:34:54 +09:00
HyukWoo Park
8797883d56 Update SharedArrayBuffer.prototype.slice
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-07-06 12:34:54 +09:00
HyukWoo Park
5e93b90059 Revise TypedArray constructor
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-07-06 12:34:54 +09:00
HyukWoo Park
6cd9886200 Remove redundant string comparison in cmake build
* 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>
2021-07-06 11:15:47 +09:00
HyukWoo Park
0b0ddee8e1 Refactoring index property handling
* 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>
2021-07-05 13:20:38 +09:00
Seonghyun Kim
12855be3f6 Implement accessing class private members in eval
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-07-05 13:08:59 +09:00
HyukWoo Park
43577f33e3 Fix a bug in array index conversion
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-07-02 12:54:09 +09:00
Seonghyun Kim
8c3cd2f3b1 Implement chain of ClassPrivateMemberData
* 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>
2021-07-01 16:36:39 +09:00
Seonghyun Kim
9c437bd8d7 Update rules related with constructor and prototype in class parsing
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-07-01 16:36:39 +09:00
Seonghyun Kim
1fbaf749bf Implement ObjectPrivateMemberStructre for reducing memory usage
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-07-01 16:36:39 +09:00
Seonghyun Kim
4aeee459b3 Implement private class members initialize order
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-07-01 16:36:39 +09:00
Seonghyun Kim
050812963e Implement one of nesting class private rule
- We need to check object value is homeobject if there is same private name on parent class

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-07-01 16:36:39 +09:00
HyukWoo Park
ef4387828c Refactor SharedArrayBuffer and Atomics
* update Atomics builtin operations
* fix hierarchy between SharedArrayBuffer and ArrayBuffer

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-07-01 09:19:56 +09:00
HyukWoo Park
70ecdf0214 Fix minor code defects
* fix to static functions
* fix to const functions
* remove unused variables

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-06-30 13:55:52 +09:00
HyukWoo Park
dd9e38f2bd Unify getter/setter methods for 32bit and 64bit platforms
* run additional test262 for 32bit-release environment

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-06-29 17:16:17 +09:00
HyukWoo Park
9de4409e4f Update basic Atomics operations (threading)
* add Atomics builtin object and its basic operations

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-06-29 17:16:05 +09:00
HyukWoo Park
a3aedf3fc5 Update CI for small build configuration
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-06-29 17:16:05 +09:00
Seonghyun Kim
5a9b538077 class expression private name tests should refer parent class's private names
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-06-28 12:58:10 +09:00
Seonghyun Kim
1c5f4ab506 Implement private field optional chaining
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-06-28 12:58:10 +09:00
HyukWoo Park
c5d10c08da Update CodeCache for private class field
* add CodeCache routine for ComplexSetObjectOperation and ComplexGetObjectOperation
* fix to use c++ style cast

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-06-28 10:38:37 +09:00
Seonghyun Kim
e341516cae Implement isModuleNamespaceObject
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-06-23 15:58:46 +09:00
Seonghyun Kim
4de5ea05bf Implement basic of class private static method
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-06-23 15:55:18 +09:00
Seonghyun Kim
e7f21e36e4 Implement basic of private static field
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-06-23 15:55:18 +09:00
HyukWoo Park
a30be877b3 Update CI for threading test
* move x86 test to github actions
* Jenkins evaluates threading features on test262 TC

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-06-17 11:09:33 +09:00
HyukWoo Park
324baba180 Update basic SharedArrayBuffer features (threading)
* add SharedArrayBuffer object
* update BackingStore to represent shared data block

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-06-17 11:09:33 +09:00
Seonghyun Kim
25679c9980 Fix negative ValueRef integer bug with ESCARGOT_USE_32BIT_IN_64BIT flag
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-06-17 11:03:40 +09:00
Hosung Kim
5a67c9d66a Add toInteger to public api
Signed-off-by: Hosung Kim hs852.kim@samsung.com
2021-06-09 15:45:46 +09:00
Seonghyun Kim
7b0a24f1a7 Implement basic of class private field and method
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-06-08 13:00:26 +09:00
HyukWoo Park
dfdb1203d6 Fix a bug when a native function instantiated from FunctionTemplate is called as super
* create a new object of which proto is set based on newTarget

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-06-07 14:53:15 +09:00
HyukWoo Park
616f32bb79 Remove ESCARGOT_OBJECT_SUBCLASS_MUST_REDEFINE macro
* override keyword specified instead

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-06-03 10:52:31 +09:00
HyukWoo Park
006b189d5f Update ObjectRef::enumerateObjectOwnProperties api
* add tryToUseAsArrayIndex api for enumeration
* fix UInt-naming

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-06-03 10:52:31 +09:00
HyukWoo Park
75d5a1dfb7 Add conversion from ObjectGetResult to ObjectPropertyDescriptor
* 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>
2021-06-02 10:33:16 +09:00
HyukWoo Park
bf7a0978bf Collect WASM heap after wasm_func_call
* 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>
2021-05-28 11:08:26 +09:00
Ryan Hyun Choi
b0cace6695 Add RegExpObjectRef::match() in public API
Signed-off-by: Ryan Choi <ryan.choi@samsung.com>
2021-05-27 17:08:24 +09:00
Ryan Hyun Choi
c6562e7940 Add RegExpObjectRef::create() in public API
* Make create() to accept options in enum

Signed-off-by: Ryan Choi <ryan.choi@samsung.com>
2021-05-27 14:52:12 +09:00
HyukWoo Park
a16fcc9412 Update es-actions to test various build options within x64 environment
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-05-26 09:36:47 +09:00
Seonghyun Kim
712118801d Add ArrayBufferObject malloc, free handler into Platform
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-05-24 10:11:08 +09:00
HyukWoo Park
4423397fca Drop the package update command in es-actions
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-05-18 17:30:39 +09:00
HyukWoo Park
b605adbb1f Refactor GC allocation with bitmap info
* 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>
2021-05-18 15:34:07 +09:00
Seonghyun Kim
ae6c6189c0 Refactor useless checking punctuator logic in parser
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-05-18 15:32:05 +09:00
HyukWoo Park
b504600e41 Add collecting heap process for WASM
* periodically check and collect WASM heap using GC event

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-05-17 15:28:03 +09:00
Seonghyun Kim
a190dae51a Implement basic parsing of class private field
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-05-17 14:32:54 +09:00
HyukWoo Park
28fad70183 Rebalance CI workload
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-05-14 09:43:47 +09:00
Hosung Kim
122e93ed4b Enable symbol visibility of ObjectPropertyDescriptorRef
Signed-off-by: Hosung Kim hs852.kim@samsung.com
2021-05-13 14:26:33 +09:00
HyukWoo Park
d3acce83a3 Add optional parameter to represent possible ASCII case for string api
* for non-ASCII case, ASCII string checking is skipped

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-05-12 20:14:36 +09:00
Hosung Kim
c05f35930f Fix ObjectPropertyDescriptor
Signed-off-by: Hosung Kim hs852.kim@samsung.com
2021-05-12 16:35:45 +09:00
Seonghyun Kim
8444ae515f Add receiver parameter to NamedPropertyHandlers
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-05-11 11:51:17 +09:00
Seonghyun Kim
8e71c6e208 Pass receiver to Object::get, Object::{get, set}IndexedProperty operation
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-05-11 11:51:17 +09:00
HyukWoo Park
dc84b4af2c Use argument name GC for new operator overloading
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-05-10 10:53:49 +09:00
HyukWoo Park
ea23b52754 Enable new operator for ObjectPropertyDescriptorRef
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-05-10 10:53:49 +09:00
Seonghyun Kim
ebeef8b62a Implement ObjectTemplate::installTo function
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-05-06 15:47:07 +09:00
Seonghyun Kim
480d567c1e Add a test for new public API ObjectTemplateRef::installTo
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-05-06 15:47:07 +09:00
HyukWoo Park
e3187e52ae Handle tagged template literal in CodeCache
* 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>
2021-05-06 10:12:42 +09:00
Seonghyun Kim
5192d33431 Object Data Accessor property can be act like JavaScript getter setter
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-05-03 19:02:49 +09:00
Seonghyun Kim
f6760e1974 Add new NativeDataAccessor property test
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-05-03 19:02:49 +09:00
HyukWoo Park
56035a1c18 Fix WASMMemoryObject buffer getter to reflect data block update
* 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>
2021-04-28 13:43:00 +09:00
Seonghyun Kim
cce7902efb Update test262 driver for testing hashbang test & exclude file
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-04-26 11:53:13 +09:00
Seonghyun Kim
11c3bcc964 Implement hashbang grammar
https://github.com/tc39/proposal-hashbang

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-04-26 11:53:13 +09:00
Seonghyun Kim
74903e85ed Implement BackingStore
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-04-21 16:27:46 +09:00
Seonghyun Kim
a30990e351 Add BackingStore test first
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-04-21 16:27:46 +09:00
seonghyun kim
032145b2d4 Add ucnv_fromUnicode function on RuntimeICUBinder
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-04-20 09:09:41 +09:00
Seonghyun Kim
0711d88306 Revise script parser
* Enable for await statement for Global Module code
* Disable html comment when parsing module code

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-04-16 09:58:15 +09:00
Seonghyun Kim
025607bddc Implement Dynamic Import resolution, rejection
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-04-15 10:58:10 +09:00
Seonghyun Kim
1a51cff06d Implement module import rejection
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-04-15 10:58:10 +09:00
Seonghyun Kim
4cd0da1e07 Implement await dynamic import resolution
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-04-15 10:58:10 +09:00
HyukWoo Park
c4073deee7 Fix self-reference in class static field initialization
* handle class constructor as a virtual parameter which is passed for static field initialization function

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-04-13 15:32:36 +09:00
Seonghyun Kim
5213b1fe11 Implement executeAsyncModule spec
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-04-12 10:17:09 +09:00
Seonghyun Kim
75c0c4bff2 Update Script Module data for following new spec & remove useless member variable
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-04-12 10:17:09 +09:00
HyukWoo Park
a847cf50ee Update spec document file
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-04-12 09:57:47 +09:00
HyukWoo Park
c605227f35 Fix internal compile error about designated initializers
* 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>
2021-04-09 09:19:08 +09:00
HyukWoo Park
27ed2989e1 Handle cases when binding object of with statement has @@unscopables property
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-04-07 19:26:47 +09:00
HyukWoo Park
8a1100c18e Update syntax error check for let array expression
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-04-07 19:26:47 +09:00
HyukWoo Park
25b2779454 Add SetIntegrityLevel operation api
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-04-07 19:16:44 +09:00
HyukWoo Park
f540c36edb Add syntax error about declarations for if statement
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-04-07 12:06:39 +09:00
HyukWoo Park
b2b9fb6afd Fix labelled typo
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-04-07 12:06:39 +09:00
seonghyun kim
e601d60247 Optimize decodeURIComponent, escape, encode
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-04-06 09:47:42 +09:00
HyukWoo Park
6610ae4825 Throw SyntaxError when function or class declaration is not located correctly
* 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>
2021-04-05 12:47:00 +09:00
HyukWoo Park
71bf5f6c89 Fix a bug in FinalizationRegistry.prototype.cleanupSome
* add check if callback is present and not undefined

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-04-05 12:47:00 +09:00
Seonghyun Kim
11ff71be71 Implement TemplateNamedPropertyHandlerGetPropertyDescriptorCallback on ObjectTemplate
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-03-30 09:03:42 +09:00
Seonghyun Kim
ec3fd74882 Update public API
* Add const for ObjectPropertyDescriptorRef member functions
* Add FunctionTemplateRef::setName

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-03-30 09:03:42 +09:00
HyukWoo Park
5517dbf80a Remove unused variables and functions
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-03-29 09:30:06 +09:00
Seonghyun Kim
0dc287a81a We can use only one LargeStringBuilder for JSON.stringify
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-03-25 16:48:50 +09:00
seonghyun kim
dc7b3b684a Optimize JSON functions
* Add fast path for PromiseObject::newPromiseCapability

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-03-25 16:48:50 +09:00
HyukWoo Park
07d30825a0 Update BigInt exception handler
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-03-25 10:05:45 +09:00
HyukWoo Park
4b864fb05b Fix CodeCache error
* handle InitializeClass bytecode caching correctly
* caching CodeBlock based on index

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-03-25 10:05:10 +09:00
Seonghyun Kim
495437c814 Avoid use of c++ exception when implementing ExeuctuionPauser
* Optimize StringBuilder

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-03-24 10:30:35 +09:00
HyukWoo Park
5b164c2247 Rollback CMake minimum version to 2.8
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-03-23 16:10:11 +09:00
HyukWoo Park
128dd635fa Fix a defect in String replaceAll method
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-03-23 16:10:11 +09:00
HyukWoo Park
7fc1ffe023 Handle BigInt value in CodeCache
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-03-18 11:00:08 +09:00
HyukWoo Park
8f4b125b22 Revise Jump bytecode and JumpFlowRecord for CodeCache
* 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>
2021-03-18 10:24:44 +09:00
HyukWoo Park
fabdc578d9 Fix to get the code cache directory through api function
* fix coverity issue too

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-03-16 11:48:02 +09:00
HyukWoo Park
b3f9c43c17 Update wabt module
* update wabt release version to 1.0.21
* add wasm-gc interface

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-03-15 15:25:04 +09:00
HyukWoo Park
e9afc5c595 Update VMInstance global variables
* manage global variables as VMInstance static members
* access global variables through VMInstance static functions

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-03-15 15:24:50 +09:00
HyukWoo Park
16639b9256 Change the name of StorePositiveIntergerAsOdd
* fix typo and change the name more clearly

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-03-11 15:19:52 +09:00
HyukWoo Park
6469a82116 Fix YarrPattern to correctly reference GC memory
* 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>
2021-03-11 15:19:52 +09:00
HyukWoo Park
2b775dc2f5 Revise BigInt not to hold VMInstance pointer
* 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>
2021-03-10 12:29:55 +09:00
HyukWoo Park
27e6876263 Refactoring API using macro
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-03-10 12:29:27 +09:00
Bence Gabor Kis
01541b923f Update TypeArray Detachbuffer
related test262 test-cases has been removed from the skip list

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2021-03-08 16:13:44 +09:00
HyukWoo Park
e47add9264 Remove ambiguous NULLABLE macro
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-03-04 15:53:45 +09:00
HyukWoo Park
2e65174096 Add DataViewObject api
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-03-04 15:53:45 +09:00
Bence Gabor Kis
15694a017c Update promise to the latest standard
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2021-03-04 14:45:44 +09:00
Seonghyun Kim
64e24255cb Fix memory bugs
* 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>
2021-03-04 09:35:30 +09:00
Seonghyun Kim
eb3d7667a9 Fix YarrPattern memory bug
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-03-02 13:48:38 +09:00
Seonghyun Kim
b387087dab test module condition in ExecutionState::inPauserScope
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-03-02 12:40:44 +09:00
Seonghyun Kim
40ebd4f837 await identifier is illegal expression on async function parameter
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-03-02 12:40:44 +09:00
bence gabor kis
160cb37300 Update name and length property order
also fixed few test262 test-case

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2021-02-22 12:17:24 +09:00
HyukWoo Park
42e598f57c Clean up legacy features in RegExp
* refactoring code related to legacy features

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-02-22 10:36:32 +09:00
Seonghyun Kim
2c4174f93b Add ArrayObjectRef::attachExternalBuffer API
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-02-22 10:36:09 +09:00
Seonghyun Kim
161f516c54 Implement basic things of top level await
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-02-18 14:52:23 +09:00
HyukWoo Park
30af8444ad Fix gc conflict of object kinds in debug mode
* clean up custom allocator too

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-02-17 12:04:13 +09:00
HyukWoo Park
511d19d266 Fix test262 driver to correctly count the total test number
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-02-17 11:54:22 +09:00
HyukWoo Park
4d307d221f Add missing api
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-02-17 10:17:56 +09:00
Bence Gabor Kis
560f1f233d Implement Legacy RegExp features
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2021-02-16 11:59:09 +09:00
HyukWoo Park
90522697eb Refactoring Job
* all types of job now handled in the task queue

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-02-16 09:34:31 +09:00
Seonghyun Kim
01e61f1242 Revise WeakMap and WeakSet
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-02-11 21:25:23 +09:00
Seonghyun Kim
a25f790cd3 Make public EvaluatorResult copyable
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-02-09 17:47:27 +09:00
Seonghyun Kim
a2d2bf01b8 Implement FinalizationRegistry.prototype.cleanupSome
* FinalizationRegistry should have weak reference of Object

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-02-09 17:47:27 +09:00
HyukWoo Park
cbc4723a26 Update test262 TC
* test262 main branch (commit id: fd27d1f5d00dcccc5f763252fc11b575ee0bdd2f)

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-02-08 18:40:51 +09:00
HyukWoo Park
c115ba53bf Add WebAssembly api
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-02-08 16:15:05 +09:00
HyukWoo Park
cbf1bfaaa1 Add finalizer correctly for WASM objects
* use addFinalizer register to deal with WeakRef

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-02-08 16:15:05 +09:00
HyukWoo Park
fef432bc71 Fix build and test errors on Ubuntu 20.04
* 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>
2021-02-05 10:15:38 +09:00
HyukWoo Park
38abe179bd Update required cmake version to 3.0.0
* cmake < 2.8.12 will be deprecated in the future

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-02-05 10:15:38 +09:00
Seonghyun Kim
390261326e Store m_target of WeakRefObject as weak reference
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-02-03 12:18:02 +09:00
HyukWoo Park
7159768d6b Fix rapidjson file format as to unix format
* rapidjson files have been dos format so far

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-02-03 10:36:20 +09:00
Bence Gabor Kis
7b7055acdd Implement String , TypeArray and Array.prototype.at
https://tc39.es/proposal-relative-indexing-method/#sec-array-prototype-additions

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2021-02-02 15:21:17 +09:00
Seonghyun Kim
b791bd9850 Disallow using arguments variable in class field when using eval function
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-02-02 10:21:45 +09:00
Seonghyun Kim
109d199302 Reimplement static field initializer
* 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>
2021-02-02 10:21:45 +09:00
HyukWoo Park
28fad835a2 Fix build errors in github actions
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-02-01 11:29:19 +09:00
Seonghyun Kim
d088f0416e class should define name before define prototype
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-01-28 14:37:35 +09:00
Seonghyun Kim
cdf986151b class should define its name first
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-01-28 14:37:35 +09:00
Seonghyun Kim
446afea853 Fix svace errors
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-01-28 14:37:35 +09:00
Seonghyun Kim
7047a7e0f7 class should evalutate field names first
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-01-28 14:37:35 +09:00
Bence Gabor Kis
92d8cedd45 Update Regexp prototype @@replace to newest standart
related test-cases has been removed from test262 skip list

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2021-01-27 11:35:33 +09:00
HyukWoo Park
71f595d086 Log error message from wasm trap
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-01-27 11:03:52 +09:00
HyukWoo Park
aa317fdedf Fix WASMMemoryObject to attach a predefined address value for empty block
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-01-27 11:03:52 +09:00
bence gabor kis
572a7eb3a2 Implement FinalizationRegistry object
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>
2021-01-26 12:02:22 +09:00
Seonghyun Kim
6a44d5c7e6 Reset m_proto of ScriptVirtualArrowFunctionObject correctly
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-01-26 10:14:22 +09:00
Seonghyun Kim
5f75330bab Check computed name correctly in class static field
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-01-26 10:14:22 +09:00
Seonghyun Kim
2dee70d5ff Implement super expression for class field
* Add toPropertyKey call for property key name

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-01-26 10:14:22 +09:00
Bela Toth
ee5d4d5006 Add Unicode pattern table generator
The script uses WebKit algorithm to generate new tables
directly from the UCD files.

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2021-01-25 16:23:07 +09:00
HyukWoo Park
b6499d8564 Fix memory leak in WASM
* 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>
2021-01-22 11:46:09 +09:00
Seonghyun Kim
dac08ab369 Implement runtime things of class field
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-01-21 18:22:20 +09:00
Seonghyun Kim
20f3478f3d Implement parsing class field and add field init function
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-01-21 18:22:20 +09:00
HyukWoo Park
ff70851d7a Update WebAssembly.instantiate
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-01-20 15:04:17 +09:00
HyukWoo Park
c5f310ee8c Update ExportedFunction name property
* get a function index from instance object which needs to be revised later

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-01-19 15:15:01 +09:00
Bela Toth
b2e862a4f7 Upgrade ICU tables to enable RegExp property escape tests
Removed passing tests from exclude list

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2021-01-18 15:01:25 +09:00
bence gabor kis
ccd0ec704c Implement WeakRef Object
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>
2021-01-18 14:53:54 +09:00
HyukWoo Park
6f3d58c75d Update wabt module
* 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>
2021-01-15 11:40:23 +09:00
Seonghyun Kim
5016b7af3b Implement fast-path of super expression in static field initializer
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-01-15 11:39:57 +09:00
HyukWoo Park
3e68f2544b Fix coverity issues in WebAssembly
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-01-13 17:07:32 +09:00
HyukWoo Park
e93df95534 Add partial-passing memory TC
* shared buffer is not yet supported

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-01-13 17:07:32 +09:00
Seonghyun Kim
f0c64aa74a Implement super keyword in class static field init
* Implement Open, Close env Bytecode for this

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-01-13 17:06:44 +09:00
HyukWoo Park
06270219e1 Fix WebAssembly object caching based on wasm_ref_t comparison
* 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>
2021-01-12 11:46:00 +09:00
Hosung Kim
c7518b5b31 Disable asan watchdog in unloadWorker function
Signed-off-by: Hosung Kim hs852.kim@samsung.com
2021-01-12 11:32:04 +09:00
bence gabor kis
70fae23a9f Implement String.prototype.replaceAll builtin method
related test262 test-cases has been removed from the skip list

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2021-01-12 10:57:20 +09:00
Seonghyun Kim
19823a483b Add this support for eval in class static field init
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-01-05 15:17:14 +09:00
Seonghyun Kim
58af1ce82c Implement class static field this value of arrow function in field init
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-01-05 15:17:14 +09:00
Seonghyun Kim
658834dbe5 Implement basic this keyword operation of static class field
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-01-05 15:17:14 +09:00
Seonghyun Kim
4f122f2900 Implement basic operation of static class field
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-01-05 15:17:14 +09:00
HyukWoo Park
8453433fea Update getting proto handler for each WebAssembly constructor
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-01-05 14:42:42 +09:00
HyukWoo Park
53941e1b3a Fix coverity check
* fix conflict with 'typeof' keyword
* include WASM module to coverity scan analysis

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-01-04 18:40:54 +09:00
HyukWoo Park
e4eca708d4 Append missing constructor property for each WebAssembly constructor's prototype
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-01-04 11:04:16 +09:00
HyukWoo Park
ec205b4b1d Fix error handling in WebAssembly.Instance constructor
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-01-04 11:04:16 +09:00
HyukWoo Park
912edcf19a Fix the name of getter/setter methods in WebAssembly objects
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-01-04 11:04:16 +09:00
HyukWoo Park
0ad8bf8e0e Refactoring StaticStrings
* sort string elements in the order
* remove needless keyword strings

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-12-29 14:42:43 +09:00
HyukWoo Park
a4a6f07dfb Implement WebAssembly.Instance
* add constructor and exports getter of Instance object
* update operations about imports and exports

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-12-29 14:42:31 +09:00
HyukWoo Park
e669f69b49 Add WASMInstanceObject
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-12-29 14:42:31 +09:00
HyukWoo Park
6061165890 Fix the internal order of Object.prototype.toString operation
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-12-28 11:42:16 +09:00
HyukWoo Park
b4e9e30e85 Fix ObjectDefineProperties operation according to the standard
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-12-28 11:42:16 +09:00
HyukWoo Park
2fec6e964d Fix redundant check code in ClassDeclarationNode
* fix svace issue

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-12-24 13:23:37 +09:00
HyukWoo Park
b30518c41f Update TestIntegrityLevel operation
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-12-23 11:39:06 +09:00
HyukWoo Park
a8e7b7d47d Update SetIntegrityLevel operation
* update freeze and seal builtin methods of Object too

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-12-23 11:39:06 +09:00
Seonghyun Kim
39e14bb0b6 Add correct toStringTag to Intl.Collator
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-12-22 14:21:40 +09:00
HyukWoo Park
0265112e48 Enable WebAssembly.Module imports builtin method with temporal wabt patch update
* imports related features will be updated officially soon

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-12-21 13:55:45 +09:00
Seonghyun Kim
44909c6b22 Merge duplicate code as macro
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-12-21 12:13:03 +09:00
Seonghyun Kim
028566a1e7 Implement Logical OR assignmenet
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-12-21 12:13:03 +09:00
Seonghyun Kim
23a9a5d76d Implement logical AND assignment
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-12-21 12:13:03 +09:00
Seonghyun Kim
3a6e3f0499 Implement Logical Nullish assignment
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-12-21 12:13:03 +09:00
HyukWoo Park
29c70f7532 Update clang-format version to 6.0
* coding convention fixed following the new clang-format

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-12-18 11:13:15 +09:00
HyukWoo Park
d3e74e6fc9 Revise WebAssembly.Table
* remove ValueVector member in WASMTableObject
* update Table builtin methods based on the latest spec

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-12-18 10:25:16 +09:00
HyukWoo Park
44f546cad6 Implement WebAssembly ExportedFunction
* 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>
2020-12-17 16:37:13 +09:00
Seonghyun Kim
402adf5e3f Update proxyCreate function in order to implementing new ECMAScript spec
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-12-17 14:01:25 +09:00
Seonghyun Kim
23566f3ae2 Fix length of valueThunk, thrower in PromiseThenFinally, promiseCatchFinally
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-12-17 14:01:25 +09:00
Seonghyun Kim
d1f9cae5af Implement Promise.any and AggregateError
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-12-16 11:15:34 +09:00
Seonghyun Kim
b562c4caf3 Implement BigInt support on debugger
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-12-15 12:18:08 +09:00
Seonghyun Kim
af81264273 Merge duplicated code as function & remove unused function
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-12-14 17:18:34 +09:00
Seonghyun Kim
5c6498ea1e Implement numberic separator for binary, octal, hex digits
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-12-14 17:18:34 +09:00
HyukWoo Park
968fef6e24 Update WebAssembly.Module builtin functions
* 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>
2020-12-14 10:21:40 +09:00
HyukWoo Park
a6c08edbc7 Refactoring WebAssembly operations
* add a new header file for wasm operations
* rename each operation with 'wasm' prefix

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-12-14 10:21:40 +09:00
Seonghyun Kim
7bb16e58a2 Implement numeric separator for decimal number
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-12-11 10:15:38 +09:00
HyukWoo Park
de94567b8e Implement WebAssembly.Global
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-12-10 11:56:25 +09:00
HyukWoo Park
fd44d83172 Refactoring value getter for builtin WebAssembly functions
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-12-09 17:39:03 +09:00
HyukWoo Park
3847058dfa Implement WebAssembly.Table
* add WASMTableObject
* update grow, get, set builtin methods and length getter property

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-12-09 17:39:03 +09:00
HyukWoo Park
9b90bd8515 Check the first argument of WebAssembly.Memory builtin functions correctly
* handle valueOf property method too

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-12-08 10:37:15 +09:00
HyukWoo Park
8429b3a523 Implement WebAssembly.Memory
* add WASMMemoryObject
* add grow and buffer properties of Memory prototype

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-12-07 10:54:35 +09:00
HyukWoo Park
24ccec9e29 Implement ArrayBuffer based on external memory
* 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>
2020-12-07 10:54:35 +09:00
HyukWoo Park
de9ad39c74 Update WebAssembly static strings
* 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>
2020-12-04 10:13:54 +09:00
HyukWoo Park
c8b3ce6bc2 Update minor things about WebAssembly
* 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>
2020-12-04 10:13:54 +09:00
HyukWoo Park
4c5beae4c5 Minor update to Error implementation
* merge error messages related with constructor methods
* add throwBuiltinError method for simple messages

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-12-04 10:09:14 +09:00
HyukWoo Park
3fd16b168b Update stable copy of buffer bytes in WebAssembly compile
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-12-01 11:32:06 +09:00
HyukWoo Park
2c622ac377 Implement WebAssembly.compile
* relevant Module object and its constructor are added too

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-12-01 11:32:06 +09:00
HyukWoo Park
1b0c8e74bf Update WebAssembly.Error
* 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>
2020-12-01 11:32:06 +09:00
HyukWoo Park
8adc7eaf23 Fix WASM build flags
* to reduce the overall libwasm binary size

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-11-27 10:03:22 +09:00
HyukWoo Park
dd4e8440f3 Implement WebAssembly Error
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-11-27 10:03:22 +09:00
Seonghyun Kim
95988cbb3e Implement BigInt.prototype.toLocaleString
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-11-25 20:10:26 +09:00
HyukWoo Park
e998d04bf6 Implement WebAssembly.validate
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-11-23 14:05:36 +09:00
Seonghyun Kim
4d1ba18a04 Update public API for BigInt
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-11-23 13:53:29 +09:00
Seonghyun Kim
6320def0ab Update builtin functions & operations for BigInt
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-11-23 13:53:29 +09:00
Seonghyun Kim
7a7ab0edbf Implement basic of BigInt64Array and BigUint64Array
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-11-23 13:53:29 +09:00
Seonghyun Kim
cf26d821de Implement DataView.prototype.{get,set}{BigInt64,BigUint64}
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-11-23 13:53:29 +09:00
Seonghyun Kim
5fae029277 Remove unused variable & Fix memory leak from VMInstance::m_cachedUTC
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-11-23 13:53:29 +09:00
HyukWoo Park
40b927adba Update wasm-js testsuite
* https://github.com/WebAssembly/spec/tree/master/test/js-api

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-11-19 21:33:47 +09:00
HyukWoo Park
9d2bde5baa Include wasm-c-api
* https://github.com/WebAssembly/wasm-c-api

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-11-18 10:32:47 +09:00
Seonghyun Kim
033fb60f2a Use external storage instead of ByteCodeCodeData for generator, async function
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-11-17 14:31:17 +09:00
HyukWoo Park
0950b63ebb Add WASM spec test
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-11-13 15:13:54 +09:00
HyukWoo Park
74bf9c3233 Import WASM interpreter
* include wabt(WebAssembly Binary Toolkit) interpreter
* https://github.com/WebAssembly/wabt
* release version 1.0.20

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-11-13 10:12:07 +09:00
Seonghyun Kim
b7638a3b51 Implement bigint shift operations
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-11-11 18:51:53 +09:00
Seonghyun Kim
840278945d Implement bitwise operations for BigInt
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-11-11 18:51:53 +09:00
HyukWoo Park
2720b9f4eb Minor fix about lexical declared function
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-11-06 17:00:18 +09:00
HyukWoo Park
3ebb4ea634 Remove redundant header files
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-11-06 17:00:18 +09:00
HyukWoo Park
820e9f0c4d Handle syntax errors for lexically declared functions
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-11-05 10:30:13 +09:00
HyukWoo Park
dae791b479 Update Jump bytecode operation
* fix JumpIfEqual bytecode correctly
* rename Jump* bytecode to represent its operation more intuitively

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-11-04 09:48:09 +09:00
HyukWoo Park
e0bd962e6e Add IsHTMLDDA feature
* 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>
2020-10-30 14:53:23 +09:00
HyukWoo Park
ca012fe376 Minor fix in Array.prototype.splice
* fix splice builtin function according to the standard

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-10-30 14:53:23 +09:00
Seonghyun Kim
6df488caaf Update many binary expressions for BigInt
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-10-27 11:00:49 +09:00
Seonghyun Kim
c6452d6d0c Fix build error related with libbf
* Don't delete generator, asyncs ByteCodeBlock

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-10-23 13:04:13 +09:00
HyukWoo Park
897a1d2ae5 Fix some minor defects and build errors
* fix defects checked by static analysis
* fix Jenkins and actions build script

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-10-23 11:28:08 +09:00
Seonghyun Kim
8765374818 Implement operations related with BigInt
* Apply new rules on ++, --, - operation
* Implement parsing hex BigInt literal
* Implement BigInt.asUintN, asIntN

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-10-23 11:26:31 +09:00
Seonghyun Kim
159e670775 Update plus, abstract relational comparions for BigInt
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-10-23 11:26:31 +09:00
MuHong Byun
827d09454d Fix several bugs on
* Data object
* ByteCodeInterpreter

(From Seonghyun Kim <sh8281.kim@samsung.com>)

Signed-off-by: MuHong Byun <mh.byun@samsung.com>
2020-10-23 10:52:58 +09:00
Seonghyun Kim
08902d66ce Update BigInt stuff
* Remove duplicate codes in BigInt and BigIntData.
* Pass more BigInts in test262

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-10-21 14:18:50 +09:00
Seonghyun Kim
44f20f0e56 When parsing string for BigInt, treat empty string as zero
* 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>
2020-10-21 14:18:50 +09:00
Seonghyun Kim
9f8b6fdb04 Don't use UnaryMinus ByteCode if possible
* 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>
2020-10-16 12:55:41 +09:00
Seonghyun Kim
8cbb7f2251 Update equal operation, unary minus for BigInt
* Implement BigIntData for fast execution

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-10-16 12:55:41 +09:00
HyukWoo Park
10ca04ae35 Add Escargot version configuration
* 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>
2020-10-15 18:59:15 +09:00
Seonghyun Kim
8821b0e275 Implement basic type operation of BigInt & basic builtin functions of BigInt
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-10-15 18:55:42 +09:00
Seonghyun Kim
9c9457ea38 Implement BigInt infrastructure
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-10-14 16:18:53 +09:00
Seonghyun Kim
b03e0ab040 Import libbf https://bellard.org/libbf/ as third_party(2020-01-19 version)
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-10-14 14:15:56 +09:00
HyukWoo Park
2a1da1930b Replace undefined or null bytecode stream with one bytecode
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-10-14 13:23:13 +09:00
HyukWoo Park
c73a012d77 Fix uninitialized member variables found by cppcheck
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-10-12 14:12:27 +09:00
HyukWoo Park
8c41696eec Fix CodeCache clear to be invoked immediately
* 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>
2020-10-12 14:11:38 +09:00
HyukWoo Park
83aadd8b42 Minor fix in CodeCache
* 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>
2020-10-08 14:41:46 +09:00
HyukWoo Park
714d398364 Fix minor style defects found by cppcheck
* add const keyword for constant functions
* reduce the scope of variables if possible

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-10-08 14:40:48 +09:00
HyukWoo Park
f168e4bd7b Remove unused codes found by cppcheck
* remove unused functions
* remove unused variables
* mark necessary but unused variables with UNUSED_VARIABLE

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-10-06 13:11:07 +09:00
seonghyun kim
a1b464f24a Fix compile error on android ndk
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2020-09-25 10:14:53 +09:00
HyukWoo Park
593a0541b3 Fix minor svace issues
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-09-23 14:07:59 +09:00
HyukWoo Park
f72bf64c69 Add cache replacement policy for CodeCache
* 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>
2020-09-23 13:55:21 +09:00
HyukWoo Park
07b7700f37 Minor fix for a type of gc malloc
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-09-23 10:22:28 +09:00
HyukWoo Park
2f41f848f0 Update minor things in CodeCache
* 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>
2020-09-21 10:33:20 +09:00
HyukWoo Park
0e51df514e Handle CodeCache file I/O errors
* 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>
2020-09-18 13:38:50 +09:00
Seonghyun Kim
a73c6de20f Fix compile error when disable ReloadableString
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-09-18 10:42:15 +09:00
HyukWoo Park
ae21ea534b Update CodeCache file management
* 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>
2020-09-16 18:27:30 +09:00
Seonghyun Kim
93f25c6298 Update gcutil & remove wrong assert macro
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-09-16 18:25:37 +09:00
HyukWoo Park
3fe7189d28 Merge caching data into one data file
* 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>
2020-09-14 11:19:18 +09:00
HyukWoo Park
4d9c840c69 Add CODEOWNERS file to assign reviewers automatically
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-09-11 14:03:59 +09:00
HyukWoo Park
120d68e73e Fix incorrect AtomicString creation based on 16bit characters
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-09-11 14:03:59 +09:00
Seungsoo Lee
a3fec47ef6 Fix coverity bug
* Fix unintentional integer overflow bug

Signed-off-by: Seungsoo Lee <seugnsoo47.lee@samsung.com>
2020-09-11 12:47:45 +09:00
HyukWoo Park
56e3ec638b Fix defects discovered in coverity scan
* fix control flow issues
* fix uninitialized variables

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-09-11 12:34:50 +09:00
Seungsoo Lee
bbacfbac0d Fix SVace bugs
* Fix uninitialized class member bug
* Change ifdef NDEBUG to ifndef NDEBUG

Signed-off-by: Seungsoo Lee <seugnsoo47.lee@samsung.com>
2020-09-10 14:44:51 +09:00
Seungsoo Lee
07270e518d Fix coverity bugs
* Fix unintentional integer overflow bug
* Fix explicit null dereferenced bug

Signed-off-by: Seungsoo Lee <seugnsoo47.lee@samsung.com>
2020-09-10 12:55:06 +09:00
HyukWoo Park
5d80acd6c3 Update github actions
* 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>
2020-09-08 11:02:47 +09:00
HyukWoo Park
2bce8e3d5e Skip generating the bytecode of strict directive
* strict directive ('use strict') just marks the strict mode without any operation

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-09-08 11:01:10 +09:00
HyukWoo Park
3ea5aa661d Fix incorrect lexical block of nested class
* 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>
2020-09-03 13:15:43 +09:00
HyukWoo Park
f951ad04b7 Enable coverity scan
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-09-03 10:53:06 +09:00
Seonghyun Kim
d4bfe59e64 Update public API for RopeString and update small config
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-08-28 10:26:20 +09:00
HyukWoo Park
b7f8a34b0e Add codecache test for x86 environment
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-08-25 11:38:57 +09:00
HyukWoo Park
cdb56523ba Update README
* add badge for license and action results
* set defualt license as lgpl-2.1

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-08-25 11:38:57 +09:00
HyukWoo Park
a96f39f0e6 Unify regular expression notation as RegExp
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-08-24 14:04:52 +09:00
HyukWoo Park
dbe6cd0e70 Handle exception cases in CodeCache
* 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>
2020-08-24 14:04:52 +09:00
Seonghyun Kim
606b59ecef Suppress false positve asan stack underflow error
+ hide public symbols if possible

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-08-24 14:03:57 +09:00
HyukWoo Park
c226d3e888 Add actions to test code cache
* print code cache logs for test mode

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-08-20 15:02:32 +09:00
HyukWoo Park
383069820a Use hash value as its file name for code caching
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-08-19 16:54:32 +09:00
Seonghyun Kim
267238ae64 Fix Reloadable string bug
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-08-13 15:17:32 +09:00
Seonghyun Kim
4e9349b999 Implement ReloadableString
* 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>
2020-08-13 14:07:37 +09:00
HyukWoo Park
a77b341324 Fix a typeof bug related with arguments object in arrow function
* 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>
2020-08-07 16:40:55 +09:00
Seonghyun Kim
a4dd449e82 Add missed operators for OptionalRef
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-08-06 16:23:26 +09:00
HyukWoo Park
f56a557ff5 Reduce memory allocation during bytecode generation
* 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>
2020-08-06 16:23:06 +09:00
Seonghyun Kim
ccdf475f9b Implement new config for smaller device
* 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>
2020-08-06 14:07:11 +09:00
HyukWoo Park
11e469c6fa Implement CodeCache for bytecode
* store/load global ByteCodeBlock

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-08-03 10:40:17 +09:00
Seonghyun Kim
3ec80377db Add new public APIs
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-07-30 15:15:18 +09:00
Seonghyun Kim
ba4763e888 Implement runtime part of dynamic-import
* Implement one of parsing error of module
* Fix one of stack usage error on FunctionObjectInlines

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-07-30 11:56:17 +09:00
Seonghyun Kim
5dc636380c Implement parsing dynamic import expression
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-07-30 11:56:17 +09:00
HyukWoo Park
436fac4423 Implement CodeCache for CodeBlock tree
* update read/write modules for CodeCache
* store and load CodeBlock tree

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-07-30 10:44:40 +09:00
Boram Bae
4faaa29331 Check return value of dlerror
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2020-07-27 21:48:40 +09:00
Ryan Hyun Choi
99b2d0f8ce Check values of getenv() for validity
Signed-off-by: Ryan Choi <ryan.h.choi@gmail.com>
2020-07-27 15:51:18 +09:00
Seonghyun Kim
25588dcb01 Implement NamedPropertyHandler API to ObjectTemplate
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-07-23 15:19:31 +09:00
HyukWoo Park
773007bec6 Each InterpretedCodeBlock has its children in a vector
* reduce the whole size of InterpretedCodeBlock instances
* iterate fastly on children

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-07-23 15:19:05 +09:00
Seonghyun Kim
906dbc6409 Add new api for Template
* Embedders can control (ESCARGOT_COMPRESSIBLE_COMPRESS_*) when compiling

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-07-17 11:30:04 +09:00
Seonghyun Kim
6503fc0416 Implement import.meta spec(MetaProperty)
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-07-16 12:51:24 +09:00
Seonghyun Kim
3f1001454e In parser, invalid assignment error is changed from ReferenceError to SyntaxError
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-07-16 12:51:24 +09:00
HyukWoo Park
586082c1d7 Fix NativeCodeBlock to directly store the native function point
* remove CallNativeFunctionData
* FunctionTemplate and native APIs allocate ExtendedNativeFunctionObject in itself

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-07-16 12:51:00 +09:00
Zoltan Herczeg
60ca7f1841 Release functions during parsing.
Fixes #702.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-07-10 09:35:02 +09:00
Seonghyun Kim
fd969d6da2 Each formal parameter should not have separate Environment Record(the spec is changed)
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-07-09 11:11:18 +09:00
Seonghyun Kim
3c642c8932 Apply new spec rules of escaped, reserved keyword
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-07-09 11:11:18 +09:00
Seonghyun Kim
cb419ec930 ASTAllocator should use various size of buffer
* Idle memory usage is reduced from 128kb to 4kb

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-07-09 11:11:18 +09:00
HyukWoo Park
747803bf81 Add InterpretedCodeBlockWithRareData
* extract infrequently used m_rareData member from InterpretedCodeBlock
* InterpretedCodeBlockWithRareData handles InterpretedCodeBlockRareData inside itself

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-07-08 16:56:44 +09:00
HyukWoo Park
2fe9333814 Divide CodeBlock into NativeCodeBlock and InterpretedCodeBlock
* NativeCodeBlock is newly added for NativeFunctionObject
* all interpreter-related info is moved into InterpretedCodeBlock

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-07-08 16:56:44 +09:00
HyukWoo Park
cd09ccbb07 Rename ASTContext structure
* rename to ASTScopeContext and ASTBlockContext
* remove redundant ASTScopeContext parameter

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-07-06 10:07:56 +09:00
Seonghyun Kim
3e1c5f3889 Reduce MemberExpression size for performance
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-07-06 10:07:28 +09:00
Seonghyun Kim
149cac159a Implement OptionalExpression and OptionalChain
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-07-06 10:07:28 +09:00
bence gabor kis
1c7a1c3e06 Update proxy object to ES2020
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-07-02 10:23:02 +09:00
Bela Toth
b69706d0a4 Enable more Unicode characters as variable names
Fixes: #656

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2020-07-01 15:10:39 +09:00
Seonghyun Kim
ca9b832a77 Introduce Object, FunctionTemplate
* Add cctest for Object, FunctionTemplates
* Fix one of EncodedValue <-> EncodedSmallValue conversion bug

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-06-29 12:38:39 +09:00
bence gabor kis
d3e5ec69ce New Feature - Nullish Coalescing (?? operator)
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-06-29 12:34:53 +09:00
Seonghyun Kim
1ab8994711 Update shell & test262 driver for running test262 tests correctly
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-06-25 18:39:09 +09:00
HyukWoo Park
6bf7a3f707 Fix type error in String::advanceStringIndex
* change the return type to uint64_t from size_t for 32bit environment

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-06-24 15:32:30 +09:00
HyukWoo Park
c7cd152802 Update the latest test262
* 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>
2020-06-24 15:32:30 +09:00
bence gabor kis
77f9f59e41 New Feature - MatchAll and RegExpStringIterator
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-06-23 16:07:25 +09:00
Seonghyun Kim
056b18547b Update Promise builtin functions according to ES2020
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-06-17 18:33:07 +09:00
Seonghyun Kim
078fd4be4f Implement Promise.allSettled and refactor
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-06-17 18:33:07 +09:00
Seonghyun Kim
3d55b0bd3a Implement globalthis property
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-06-17 18:33:07 +09:00
bence gabor kis
d517104bed Update unicode table in third_party yarr
Related test262 test-cases has been removed (from skip list)

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-06-16 08:57:01 +09:00
Robert Fancsik
7bb5428cff Fix catch parse error when the debugger is enabled
Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
2020-06-16 08:55:45 +09:00
Robert Fancsik
4dfaec7c4a Statement MetaNodes should be early constructed
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>
2020-06-11 18:12:46 +09:00
bence gabor kis
3bb4a39e50 able to send multiple source file to debugger server
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-06-11 17:54:21 +09:00
Seonghyun Kim
f82c81a5d2 In 64bit, we should use only 32bit for addressing
* 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>
2020-06-11 17:37:43 +09:00
bence gabor kis
f1d8535b92 Optimized createListFromArrayLike
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-06-11 10:45:28 +09:00
Zoltan Herczeg
7a63397e1c Implement getting object properties.
Furthermore extend get scope and get scope variables with state index parameter.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-09 08:00:29 +09:00
HyukWoo Park
bdd03a27c2 Fix memory tracing error in AsyncGeneratorObject
* fix to trace ExecutionPauser and AsyncGeneratorQueue vector members correctly

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-06-04 17:13:00 +09:00
Seonghyun Kim
6bfa3f9fff Apply lazy StaticString on builtin Intl
* Implement FromExternalMemory version of AtomicString

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-06-04 17:12:07 +09:00
Seonghyun Kim
5b3f0986b1 Implement lazy part of StaticString
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-06-04 17:12:07 +09:00
bence gabor kis
be3abac7e3 Remove infinity loop in regexp replace and match
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>
2020-06-04 14:47:14 +09:00
HyukWoo Park
e3de031d7f Use macro for GlobalObject builtins
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-06-02 14:32:00 +09:00
Seonghyun Kim
389c6d8532 Annex B defines an early error for duplicate PropertyName of __proto__, in object initializers,
but this does not apply to Object Assignment patterns

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-06-01 14:17:29 +09:00
Seonghyun Kim
39e10484d7 When parsing TemplateLiteral in TaggedTemplateExpression, we should not throw SyntaxError.
* 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>
2020-06-01 14:17:29 +09:00
HyukWoo Park
4fb663ea0e Revise TypedArray definition
* update definition of ArrayBufferView, TypedArrayObject
* access each TypedArray through TypedArrayObject transition instead of ArrayBufferView

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-06-01 11:17:36 +09:00
bence gabor kis
26b974addc Adding ExecutionState depth to backtrace info
The new member is needed to Escargot debugger backtrace function

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-05-28 17:59:20 +09:00
Robert Fancsik
c85ec4f4a9 Statements LOC info should not be modified when the debugger is enabled
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>
2020-05-27 17:43:00 +09:00
Seonghyun Kim
4f3774be0c Implement tagged-template cache on CodeBlock according to GetTemplateObject(templateLiteral) on spec
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-05-27 17:09:09 +09:00
Seonghyun Kim
fe0c65118c * When evaluate super.foo = 1 we should throw TypeError.
when PutValue is failed + isStrict('use strict` or class method).

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-05-27 17:09:09 +09:00
bence gabor kis
2784bab7e8 Added dummy get last index in Exec
The realted test262 test-cases has been removed from skip list

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-05-27 16:54:18 +09:00
HyukWoo Park
232618d09d Add Set/Map iterator API
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-05-27 12:35:19 +09:00
Seonghyun Kim
c9e4d5c6fd Implement more things about module
* 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>
2020-05-26 12:54:45 +09:00
Seonghyun Kim
ee97ae6412 Fix module bugs
* 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>
2020-05-26 12:54:45 +09:00
HyukWoo Park
912bc2d9ef Improve TypedArray performance
* 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>
2020-05-25 16:17:53 +09:00
Seonghyun Kim
9b9f980cfe Reimplement initialize & executing Module according to newer spec
* Update test runner for running module tests in test262

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-05-22 18:34:57 +09:00
Seonghyun Kim
f50838bb5b Fix yield * expression bug
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>
2020-05-22 18:34:57 +09:00
bence gabor kis
a88023c9c2 Debugger pending breakpoints
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-05-22 11:14:33 +09:00
bence gabor kis
88d055ebeb Minor Fix in RegExpObject escapeSlash
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-05-22 10:43:11 +09:00
HyukWoo Park
d1c6759483 Re-balance test list in Jenkins
* 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>
2020-05-22 10:27:45 +09:00
Bela Toth
e08c302ee5 Fix JSON.stringify property order
Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2020-05-20 15:25:27 +09:00
HyukWoo Park
b977ab7e54 Rework internal methods of TypedArray
* 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>
2020-05-19 15:21:02 +09:00
Seonghyun Kim
323c2dca20 Each function parameter should have own declarative environment.
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>
2020-05-18 15:18:10 +09:00
Seonghyun Kim
355d7244f1 Fix minor issues
* 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>
2020-05-18 15:18:10 +09:00
HyukWoo Park
8bba87833a Add TypedArrayHelper to represent common TypedArray features
* update ArrayBuffer using TypedArrayHelper
* fix a bug related to length of ArrayBuffer on 32bit

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-05-18 14:57:14 +09:00
HyukWoo Park
40574864d3 Update builtin methods of TypedArray based on ES10 (Part 2)
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-05-18 14:57:14 +09:00
bence gabor kis
b96d9c7a98 Minor fix - in Native errors
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-05-15 17:52:53 +09:00
Seonghyun Kim
6dec50591f We should create binding even there is virtual ID when executing Script
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-05-15 17:01:55 +09:00
Seungsoo Lee
c8e081d267 Fix an overflow bug
Change buffer size to PATH_MAX + 1

Signed-off-by: Seungsoo Lee <seungsoo47.lee@samsung.com>
2020-05-13 14:37:38 +09:00
HyukWoo Park
bfcc61254d Update builtin methods of TypedArray based on ES10 (Part 1)
* ArrayBufferObject methods are updated
* some part of builtin methods in TypedArray reworked based on ES10

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-05-13 10:49:55 +09:00
HyukWoo Park
99d8acbe19 Update builtin methods of ArrayBuffer based on ES10
* separate definitions of ArrayBuffer methods into GlobalObjectBuiltinArrayBuffer.cpp

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-05-13 10:49:55 +09:00
bence gabor kis
e52c7d1b00 Debugger source send by client feature
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-05-12 16:57:32 +09:00
Seonghyun Kim
a9a41ff5f0 Implement missing part of GlobalDeclarationInstantiation and EvalDeclarationInstantiation
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-05-11 16:51:29 +09:00
Seonghyun Kim
3916dad5fc Fix minor things
* 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>
2020-05-11 16:51:29 +09:00
Seonghyun Kim
a58a01e02f Implement Intl.RelativeTimeFormat
* Each Context should share supported intl locale array

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-05-08 18:04:38 +09:00
HyukWoo Park
3520529a50 Fix minor defects
* remove obsolete return statements
* add guard code in parseClassElement

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-05-08 16:09:45 +09:00
HyukWoo Park
94609f3a1a Refactoring ObjectPropertyName structure
* 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>
2020-05-08 16:08:49 +09:00
HyukWoo Park
26b8593620 Add hasRareData for Object
* hasRareData is added to reduce repetitive check executions
* rename ensureRareData

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-05-08 16:08:38 +09:00
Achie
928181bc4f Fix Strict-NonSimple parameter rules within functions
Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2020-05-07 10:11:56 +09:00
Bela
66d95455d7 Fix typo in kangax runner python file
Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2020-05-06 11:30:56 +09:00
Seonghyun Kim
a7e53a4524 Fixup minor things
* 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>
2020-05-06 11:27:31 +09:00
HyukWoo Park
3d08d78cd1 Fix ArrayBuffer allocation
* 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>
2020-05-04 12:10:44 +09:00
HyukWoo Park
c46957de8c Update length-related operations
* 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>
2020-04-28 14:48:15 +09:00
Seonghyun Kim
f37bd559bb Implement Unified Intl.NumberFormat
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-04-28 14:47:41 +09:00
Seonghyun Kim
54df9e1f2e Fix Intl::isStructurallyValidLanguageTagAndCanonicalizeLanguageTag function
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-04-28 14:47:41 +09:00
Seonghyun Kim
d1f3979123 Revise Intl.DateTimeFormat
* Add hourCycle option into IntlDateTimeFormat
* Fix many minor bugs in IntlDateTimeFormat

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-04-28 14:47:41 +09:00
HyukWoo Park
749b1b20c8 Refactoring TypedArray definition
* fix a bug about TypedArray constructor too

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-04-27 15:20:45 +09:00
Seonghyun Kim
35653123c2 Implement Intl DateTimeFormat.prototype.formatToParts
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-04-23 11:41:05 +09:00
Seonghyun Kim
4ceb0dbeab Implement Intl NumberFormat.prototype.formatToParts
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-04-23 11:41:05 +09:00
Seonghyun Kim
b91bf01178 Implement Intl.PluralRules
* Refactor Intl::getOptions

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-04-22 16:40:24 +09:00
HyukWoo Park
748c3fb3ce Update String lower, upper related conversion
* 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>
2020-04-21 16:42:03 +09:00
HyukWoo Park
50df167dd7 Fix incorrect arguments in String builtin methods
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-04-21 16:42:03 +09:00
Seonghyun Kim
5fe34d5b04 Implement GlobalObjectProxyObject for support external project
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-04-17 12:01:49 +09:00
Seonghyun Kim
2ed90b206b Update test262 template
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-04-16 11:47:59 +09:00
Zoltan Herczeg
161899bf56 Implement showing Exceptions.
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-14 19:04:15 +09:00
HyukWoo Park
46d8f2060a Rework non-standard properties of RegExp
* directly access RegExpStatus through Context
* define each non-standard property in installRegExp method
* remove GlobalRegExpFunctionObject

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-04-13 19:51:41 +09:00
HyukWoo Park
4e2dc085a4 Apply ExtendedNativeFunctionObject for CreateBuiltinFunction
* replace CreateBuiltinFunction with ExtendedNativeFunctionObject
* apply to proxy and async generator

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-04-13 19:51:41 +09:00
Seonghyun Kim
bd833cad6b Use own BCP47 parser instead of ICU
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-04-13 13:47:19 +09:00
Seonghyun Kim
ff4357e70d Implement basic of Intl.Locale
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-04-13 13:47:19 +09:00
Seonghyun Kim
e7ccb91460 Fix Intl.getCanonicalLocales bugs
* Update data of grandfatheredLangTag
* Update Intl::canonicalizeLocaleList to follow new spec

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-04-13 13:47:19 +09:00
HyukWoo Park
7484927a13 Update toLocaleString builtin method based on ES10
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-04-13 13:45:58 +09:00
HyukWoo Park
4d1d55ad44 Fix minor bugs in Proxy and Reflect
* 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>
2020-04-13 13:45:58 +09:00
Seonghyun Kim
fd9a4bdb05 Add ExecutionStateRef::computeStackTraceData for external project
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-04-09 18:11:49 +09:00
Zoltan Herczeg
b4c0042680 Code reordering: move processIncomingMessages to the end of Debugger.cpp.
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-09 16:15:16 +09:00
bence gabor kis
13b81099fe Fixing TypedArrayPrototye functions
related test262 test-cases has been added

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-04-09 16:14:46 +09:00
HyukWoo Park
d46a365326 Refactoring type check operations using tag comparison
* 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>
2020-04-09 16:13:36 +09:00
bence gabor kis
25136408c2 New Feature - TypedArrayIncludes
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-04-09 10:39:51 +09:00
Zoltan Herczeg
9f347d9f10 Implement finish (step-out) operation in debugger.
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-08 17:35:21 +09:00
Seonghyun Kim
790152301c Update public API for some project
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-04-08 11:58:59 +09:00
Zoltan Herczeg
c3f23240ac Support symbols when getting variables.
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-07 19:25:31 +09:00
bence gabor kis
e31cfeeada Debugger Client print feature
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-04-06 21:04:54 +09:00
bence gabor kis
d57d22e964 Minor fixis in DataView Global builtin
related test-cases has been added in test262

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-04-06 21:03:52 +09:00
Zoltan Herczeg
fc1fac7829 Rework backtrace info.
The new code matches better to VSCode.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-06 18:14:34 +09:00
Seonghyun Kim
902c51bbc7 Fix every Intl.Collator bugs
* 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>
2020-04-03 16:20:10 +09:00
Seonghyun Kim
27f0af1859 Fix bugs in Intl
* Give correct prototype into Intl Objects
* Implement Array.prototype.toLocalString according spec

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-04-03 16:20:10 +09:00
HyukWoo Park
d839f87b0b Update Number builtin methods based on ES10
* 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>
2020-04-03 13:44:57 +09:00
HyukWoo Park
93f225db2d Fix Date to represent year with padding zeros
* year value is represented as 4 fixed length with padding zeros

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-04-03 11:30:33 +09:00
HyukWoo Park
0f81aa5dce Represent all global error messages by static class members
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-04-03 11:30:10 +09:00
Achie
3f8f366b98 Modify kangax file, to enable async checks
This will enable to run functions, scripts to be run after the main
script has finished for kangax.

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2020-04-03 09:44:24 +09:00
Seonghyun Kim
1bd124fc1b Revise function call & Realm
* 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>
2020-04-02 17:06:53 +09:00
Zoltan Herczeg
3f63741714 Implement getting property name / value pairs in the debugger.
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-01 21:15:11 +09:00
Zoltan Herczeg
064d1d09b8 Fix debugger support for arrow functions and var/let/const statements.
Declarations with assignment should insert breakpoints, while
declarations without assignment should not.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-01 15:14:33 +09:00
HyukWoo Park
c627ca4fe0 Remove legacy [[class]] internal property
* internalClassProperty method which represents legacy [[class]] property is entirely removed

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-04-01 14:29:19 +09:00
HyukWoo Park
32f6f6938e Update Object.prototype.toString based on ES10
* 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>
2020-04-01 14:29:19 +09:00
HyukWoo Park
38750ec549 Fix Iterator and WeakMap prototype objects to be an ordinary object
* remove ArrayIteratorPrototypeObject
* fix ArrayIteratorPrototype.next to throw a TypeError for detached buffer

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-04-01 10:23:49 +09:00
Achie
3fd2b67431 Add kangax runner
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
2020-03-30 15:45:23 +09:00
bence gabor kis
295c4c21e5 ProxyObject fix in ownPropertyKeys
Related test-cases in test262 added

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-03-26 18:18:38 +09:00
Zoltan Herczeg
a7a24cf22e Support getting scope chain in the Debugger.
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-03-26 18:16:56 +09:00
bence gabor kis
8de35fd707 Add Escargot-Debugger test runner
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>
2020-03-26 18:16:33 +09:00
bence gabor kis
52bfc6054b New Feature - Symbol get description
Removed the related test-cases in test262

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-03-26 15:39:55 +09:00
HyukWoo Park
e471c66e27 Fix Function.prototype.toString to handle non function objects
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-03-25 17:14:14 +09:00
HyukWoo Park
5c8c4da50a Remove redundant prototype classes
* 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>
2020-03-25 17:13:58 +09:00
HyukWoo Park
58681e5d4e Remove unused type check virtual functions
* Object, String and Symbol use tag value for faster type check

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-03-25 17:13:58 +09:00
Seonghyun Kim
07a1e2b26f Restore fast path of String.prototype.replace
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-03-24 18:42:34 +09:00
HyukWoo Park
39a5922437 Fix [[Prototype]] initialization process for each object creation
* 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>
2020-03-24 18:26:25 +09:00
bence gabor kis
c7cd02a959 Minor fixis in String prototype
Related test-cases added in test262

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-03-23 13:32:59 +09:00
Zoltan Herczeg
d2cc5fec47 Support evaluating expression in the debugger.
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-03-23 12:16:50 +09:00
Seonghyun Kim
5a284d486b Implement additional ECMAScript Features for Web Browsers
* Implement VariableStatement in catch rules
* Implement Function Declation rules

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-03-19 15:01:26 +09:00
Seonghyun Kim
a656f7e4dd Implement $262 object and its builtins for passing test
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-03-19 15:01:26 +09:00
bence gabor kis
9af435aa26 Minor fix - update RegExp.compile
removed few related test-cases in test262

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-03-19 12:12:01 +09:00
Zoltan Herczeg
c71d3cbd81 Support backtrace in the debugger.
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-03-19 12:08:52 +09:00
Achie
f1c1e739ac Enable u+2028 and 2029 seperator characters
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
2020-03-19 11:25:07 +09:00
Seonghyun Kim
4670a4097f Implement additional ECMAScript Features for Web Browsers
* Implement rules of Global Function declaration

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-03-18 16:57:42 +09:00
Seonghyun Kim
cf2c21e023 Implement additional ECMAScript Features for Web Browsers
* 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>
2020-03-18 16:57:42 +09:00
HyukWoo Park
2c386d65b0 Apply coding convention to third party
* check_tidy script has been fixed to print only format errors

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-03-17 11:02:27 +09:00
HyukWoo Park
97940b157e Fix minor bugs in Promise prototype object
* %PromisePrototype% is an ordinary object but not a Promise object
* PerformPromiseThen returns Object pointer

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-03-17 11:02:02 +09:00
HyukWoo Park
ed616194d8 Implement OrdinaryCreateFromConstructor
* 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>
2020-03-16 16:52:44 +09:00
HyukWoo Park
e32b181f4f Add NewTarget parameter to builtin functions
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-03-16 16:52:44 +09:00
Zoltan Herczeg
0d45add63e Support control flow tracking for loops with empty body and statements with state.
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-03-16 15:38:01 +09:00
bence gabor kis
193d27a300 New Feautre - Unicode property escape
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-03-12 16:57:45 +09:00
HyukWoo Park
d9a9bcf860 Remove duplicated check code in Construct operation
* 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>
2020-03-12 13:32:31 +09:00
Seonghyun Kim
1a1078a462 Should treat state of async, * correctly for class method, object method
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-03-12 13:31:43 +09:00
Seonghyun Kim
ae4b3ee589 Fix bugs
* 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>
2020-03-12 13:31:43 +09:00
Seonghyun Kim
42ddf7e64e Fix license error of runtime_icu_binder
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-03-12 13:31:43 +09:00
Seonghyun Kim
2beb6bea8b Compute script execution result correctly
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-03-12 13:31:43 +09:00
Bela Toth
e53850470d Implement optional catch binding
Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2020-03-12 11:14:52 +09:00
bence gabor kis
32f0cf6a17 New feature - regexp named capture groups
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-03-11 10:59:34 +09:00
MuHong Byun
589611334a Update submodule to fix LGPL License verison typo (2.0 -> 2.1)
Signed-off-by: MuHong Byun <mh.byun@samsung.com>
2020-03-10 12:12:17 +09:00
MuHong Byun
e2f1c3f47d Fix LGPL License verison typo (2.0 -> 2.1)
Signed-off-by: MuHong Byun <mh.byun@samsung.com>
2020-03-10 11:35:20 +09:00
Zoltan Herczeg
bf3a8c7463 Add support for next and stop operations for the Debugger.
Furthermore the function info is displayed when we stop inside a function.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-03-09 16:17:04 +09:00
HyukWoo Park
9c73273126 Replace each CreateBuiltinFunction with ExtendedNativeFunctionObject
* 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>
2020-03-09 15:31:57 +09:00
bence gabor kis
e735f3e55b Minor fix in ProxyObject
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>
2020-03-06 16:35:17 +09:00
Seonghyun Kim
91b8b016b3 Implement for-await-of statement
* 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>
2020-03-06 14:48:58 +09:00
HyukWoo Park
bbc50947d0 Unify option list in RegExpObject and RegExpObjectRef
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-03-06 14:35:52 +09:00
Grzegorz Wolny
df297df741 Add minimal support for replace invalid utf8
Signed-off-by: Grzegorz Wolny <g.wolny@samsung.com>
2020-03-06 10:31:38 +09:00
Seungsoo Lee
0cfc8a008a Update LICENSE file
Signed-off-by: Seungsoo Lee <seungsoo47.lee@samsung.com>
2020-03-05 16:06:10 +09:00
Zoltan Herczeg
a555ac52f6 Initial implementation of the Escargot Debugger. 2020-03-05 10:36:55 +09:00
Bela Toth
36e5291bfe Implement Promise.prototype.finally
Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2020-03-05 10:36:13 +09:00
Seonghyun Kim
ed921de4a4 We should make lexical block for function decl in if-statement without brace
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-03-03 18:41:19 +09:00
Seonghyun Kim
8c776cfe10 Fix generator bugs
* 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>
2020-03-02 13:47:22 +09:00
Seonghyun Kim
9227af8dca Give correct length for builtin Generator functions
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-03-02 13:47:22 +09:00
Seonghyun Kim
d948604057 Remove wrong steps on PromiseResolveThenable.
capability.m_rejectFunction will change alreadyResolved state

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-03-02 13:47:22 +09:00
Seonghyun Kim
e4098e1d36 Pauseable functions(generator, async..) can be recursively called.
thus we need to check loop on ExecutionPauserExecutionStateParentBinder

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-03-02 13:47:22 +09:00
Seonghyun Kim
21ed849342 Revise iteration
* 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>
2020-02-25 13:19:47 +09:00
Seonghyun Kim
81c8c005cf Implement more things about async generator
* 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>
2020-02-20 11:36:14 +09:00
bence gabor kis
81a0e9e1ca Minor Fix in RegexpObject Match
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-02-19 13:42:49 +09:00
bence gabor kis
3f6c034b51 Minor fix - enable UTF-32 character key property to an object
Allows UTF-32 characters in identifiers.

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-02-19 11:13:09 +09:00
HyukWoo Park
0e93724832 Allocate YarrPattern::m_captureGroupNames on GC heap
* 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>
2020-02-17 17:19:31 +09:00
Seonghyun Kim
fc5a92554c When call AsyncGenerator, it should be executed until parameter initialize block
+ 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>
2020-02-14 16:37:45 +09:00
Seonghyun Kim
0ff2097796 Give correct [[prototype]] value for Generator, AsyncGeneratorObject when its source functions have invalid prototype value
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-02-14 16:37:45 +09:00
Seonghyun Kim
ad6a0e9114 Allow async generator for object init, class
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-02-14 16:37:45 +09:00
Seonghyun Kim
e38424a036 Give correct prototype for instances of AsyncGeneratorFunction
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-02-14 16:37:45 +09:00
HyukWoo Park
e2029096f1 Fix minor defects
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-02-07 16:09:23 +09:00
HyukWoo Park
b37be56054 Add implicit name to getter, setter function definition
* 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>
2020-02-05 16:17:00 +09:00
HyukWoo Park
86a125ef36 Add function and class name in object expression
* 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>
2020-02-05 16:17:00 +09:00
HyukWoo Park
021f3aa848 Update make_excludelist script
* print messages clearly
* add path for backtrace-hooking generation

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-02-03 13:49:58 +09:00
HyukWoo Park
eb1bbd0c3f Fix a case in which parameter value is referenced before initialization to throw a reference error
* add ThrowStaticErrorOperation bytecode for each pre-accessed parameter value

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-02-03 13:49:44 +09:00
HyukWoo Park
3c6032f8c9 Fix bugs in function parameter
* 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>
2020-02-03 13:49:44 +09:00
HyukWoo Park
a36bd117d3 Fix minor bugs in parsing
* 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>
2020-02-03 13:49:30 +09:00
Seonghyun Kim
f61ef74973 Implement basic of AsyncGeneratorFunction
* Add ScriptAsyncGeneratorFunctionObject, AsyncGeneatorObject
  * Implement basic behavior of AsyncGeneratorFunction

Update Script Parser
  * Reverse allowYield value.
  * Allow AsyncGenerator
  * In parameter, we should not allow yield, await expression

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-02-03 11:50:26 +09:00
HyukWoo Park
f2439c2a41 Fix bugs in destruction operation
* 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>
2020-01-23 14:36:18 +09:00
Seonghyun Kim
ae35a576f5 Implement more things according to newer ECMAScript spec
* 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>
2020-01-22 18:01:52 +09:00
HyukWoo Park
f232bba7d7 Add class implicit name in array/object pattern
* 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>
2020-01-21 11:03:05 +09:00
Seonghyun Kim
5e7f0da0ee Fix various bugs
* 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>
2020-01-17 17:18:30 +09:00
bence gabor kis
94c74a0c3d Newfeature - DotAll flag
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-01-17 10:45:43 +09:00
HyukWoo Park
41c65005ea Add make_excludelist.py script to generate exclude list of test262 automatically
* 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>
2020-01-16 16:08:04 +09:00
bence gabor kis
9ebf26846d Added RegexpExec and fix regexp.symbols
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-01-15 19:25:04 +09:00
HyukWoo Park
1667e8a360 Update iterator binding for array patterns
* 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>
2020-01-15 11:15:39 +09:00
HyukWoo Park
febe1b1134 Fix IteratorRecord as normal Object
* 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>
2020-01-15 11:15:39 +09:00
HyukWoo Park
a4c5faf323 Fix some potential defect issues
* fix svace issue

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-01-15 11:14:38 +09:00
Seonghyun Kim
60594853d2 Optimize function.apply(<any>, arguments) case.
* 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>
2020-01-15 10:33:49 +09:00
Seonghyun Kim
caa0fbc3fe Implement compress CompressibleStrings on GC reclaim end event
* Compress CompressibleStrings on GC reclaim end event
  - if there is reference about data of CompressibleString on stack, we should give up compressing.
    we don't need to search heap space because I redesigned StringView
    (we should not store string buffer data on heap without owner)
* Redesign StringView
  - Don't save string buffer address as its member. because buffer of CompressibleString can be deleted
  - If we don't save string buffer address on StringView, parser performance may dropped.
    becuase parser access string data a lot.
    so I introduce ParserStringView. it saves buffer address. we should ParserStringView on parser only.
    we can save string buffer address while parsing. because GC is disabled while parsing.

* Enable CompressibleString always
* Implement cache of RegExpOptionStrings
* Implement finding system locale function on RuntimeICUBinder avoiding call uloc_getDefault.

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-01-10 17:37:00 +09:00
HyukWoo Park
47bf20782e Check strict mode immediately
* 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>
2020-01-10 11:17:19 +09:00
Ryan Hyun Choi
32fb8f44bd Support gbs build with gcc9
Signed-off-by: Ryan Choi <ryan.choi@samsung.com>
2020-01-09 17:37:38 +09:00
Seonghyun Kim
af9b410fa7 Fix issues in some embedded platforms
* 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>
2020-01-09 16:07:51 +09:00
seonghyun kim
98d4ef6942 Reduce memory usage
* Store array length property in its member variable not value vector
  - This can reduce one of GC_MALLOC call if there is not value in ArrayObject other than fastmode value
* Prevent memory leak from VMInstance, Context
* Change vector capacity reserve strategy

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2019-12-24 14:38:09 +09:00
HyukWoo Park
b27127c3dd Update CompressibleString
* 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>
2019-12-24 13:36:12 +09:00
seonghyun kim
0a79a6c98c Fix crash
* Fix bug in inline cache
* Fix memory error while exiting

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-12-19 10:29:27 +09:00
HyukWoo Park
7c13a84057 Fix valueStringLiteral method in ScannerResult
* remove unnecessary StringView allocation
* simplify parseObjectPropertyKey mothod

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-12-18 13:38:41 +09:00
seonghyun kim
fba9396ec9 Reduce memory usage
* Reduce size of RopeString
* Use fit memory if possible for ArrayObject fastModeData
* Re-implement ByteCode pruning logic
* Re-implement inline-cache for reducing memory usage
* Remove std::vector with gc_allocator. it can cause memory leak

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-12-18 11:11:26 +09:00
HyukWoo Park
963cc4aa07 Handle destructuring in try-catch clause
* 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>
2019-12-17 09:37:43 +09:00
seonghyun kim
fb9bcbd902 even async function is ended by exception or return, we should return promise object
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-12-10 17:18:01 +09:00
seonghyun kim
a126f3dd13 Treat function parameter initialization area as first lexical block
* in parameter initialization area, we cannot access var declared variables

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-12-10 15:43:52 +09:00
seonghyun kim
80da9548d3 Async ExecutionState should have nullptr as its parent initially
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-12-09 19:40:20 +09:00
HyukWoo Park
a9ca8c58fd Enable direct threading for clang compiler
* In our environment, clang version 6+ supports the direct threading in interpreter
2019-12-09 09:56:36 +09:00
seonghyun kim
5dfcfd15bd Fix bugs related with switch statement
* 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>
2019-12-09 09:55:36 +09:00
HyukWoo Park
9cf8bc1898 Revise Iterator operations
* 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>
2019-12-05 16:31:25 +09:00
seonghyun kim
53906a6d81 Optimize runtime performance
* Optimize ObjectStructurePropertyDescriptor
* Don't initialize inline storage of VectorWithInlineStorage
* Add Object::setPrototypeForIntrinsicObjectCreation for fast initialize
* Add ArrayObject::ArrayObject(ExecutionState& state, const uint64_t& size) for fast initialize
* Store stack-limit instead of stack-base
* Reduce size of ExecutionState
* Add fast version of Object::ownPropertyKeys for optimize Object.keys
* Add ValueVectorWithInlineStorage
* Remove some compiler warnings

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-12-05 15:04:20 +09:00
seonghyun kim
0a9ec4f9eb Rename PropertyName into ObjectStructurePropertyName
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-12-05 15:04:20 +09:00
bence gabor kis
c40f0c792c new Array.prototype feature
Array.prototype.flat
Array.prototype.flatmap
FlattenIntoArray

http://ecma-international.org/ecma-262/10.0/#sec-flattenintoarray

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2019-12-03 19:23:41 +09:00
HyukWoo Park
b852fa1079 Fix a bug : ignore null or undefined value for spread element in object destructing
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-12-03 19:22:14 +09:00
seonghyun kim
875b1aa056 Improving object property accessing performance
* Finding & read desc at once in ObjectStructure
* Improve findProperty performance in ObjectStructure

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-12-02 16:44:27 +09:00
bence gabor kis
ab6f2f13b7 Update Array.prototype.includes
Added two related test262 test-cases

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2019-11-29 14:37:06 +09:00
bence gabor kis
9424965b00 New ES10 feature - Object.fromEntries
https://www.ecma-international.org/ecma-262/10.0/#sec-object.fromentries

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2019-11-27 10:58:25 +09:00
HyukWoo Park
c328e53927 Implement exponential operation
* 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>
2019-11-27 09:38:22 +09:00
Bela Toth
79bf6f31f2 Fix padStart and padEnd and enable test262 tests
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
2019-11-26 18:42:01 +09:00
Bela Toth
aa0ed9bf62 Impement TrimString and it's variaties
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
2019-11-25 18:35:15 +09:00
HyukWoo Park
d918e65ff9 Fix some parsing bugs
* 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>
2019-11-25 10:35:07 +09:00
HyukWoo Park
e6203ce708 Remove bool operator overloading in Value
* 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>
2019-11-25 10:35:07 +09:00
bence gabor kis
eb66055f29 Es8 new feature - Object.getOwnPropertyDescriptors
https://www.ecma-international.org/ecma-262/8.0/#sec-object.getownpropertydescriptors

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2019-11-25 10:33:34 +09:00
HyukWoo Park
631ed5e662 Update the latest test262
* https://github.com/tc39/test262.git (commit 7040938bd06ded171250d1e945a969f90fb37165)
* add Jenkins parallel tasks for test262

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-11-21 15:02:08 +09:00
HyukWoo Park
5b522fbc2d Fix a bug when shorthand object property is used in object destruction
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-11-18 16:05:59 +09:00
HyukWoo Park
4020f86e14 Update Escargot/new-es test submodule
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-11-18 15:56:15 +09:00
HyukWoo Park
01de1210b9 Update rest element in Object pattern
* BindingRestElement bytecode handles Iterator and EnumerateObject both
* MarkEnumerateKey bytecode is added to mark visited properties

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-11-18 15:56:15 +09:00
HyukWoo Park
b0a31717c5 Update spread element in Object initialization
* EnumerateObject is reworked and two derived classes are newly added
* Object spread element is handled through EnumerateObjectWithDestruction
* for-in operation is handled through EnumerateObjectWithIteration

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-11-18 15:56:15 +09:00
HyukWoo Park
e2e34d07db Handle assignment pattern in Object pattern
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-11-18 15:56:15 +09:00
seonghyun kim
42231eba48 Implement basic behavior of async, await.
* Add ExecutionPauser for yield, await
* Add new public API

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-11-15 16:07:03 +09:00
Bela Toth
8f3178eaec Implement ES8 String.padStart and String.padEnd
Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-11-14 09:47:27 +09:00
seonghyun kim
82c99fc298 Refactor ObjectStructure
* Divide ObjectStructure into 3 types
* Add transition look up hash map into ObjectStructureWithTransition
* Use faster version of log2 on Vector

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-11-12 10:03:03 +09:00
HyukWoo Park
863c99c73f Minor bug fix about duplicated finishIdentifier call in parser
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-11-07 14:38:04 +09:00
HyukWoo Park
1ea5ac3945 Clear up redundant submodules and script files
* rapidjson (v1.0.2) forked from https://github.com/miloyip/rapidjson
* double_conversion (v2.0.1) forked from http://code.google.com/p/double-conversion
* checked_arithmetic forked from WebKit

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-11-07 14:37:25 +09:00
HyukWoo Park
05678d6449 Update parsing of async feature
* 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>
2019-11-06 18:16:31 +09:00
HyukWoo Park
877539c538 Replace NodeVector by LinkedList
* 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>
2019-11-05 13:04:13 +09:00
Boram Bae
f2a21038cb Update to handle deleting a SuperProperty
* Pass more tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-11-05 10:27:10 +09:00
seonghyun kim
ddb1664a4e Add ES6 Unicode RegExp Syntax Errors in newer yarr
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-11-04 13:21:11 +09:00
seonghyun kim
0e3e95b3ae Update yarr version to webkitgtk-2.19.92
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-11-04 13:21:11 +09:00
Patrick Kim
e91d0f0fe7 Improve execution performance (#491)
* 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>
2019-11-04 11:18:03 +09:00
Patrick Kim
82f05fdd29 Improve performance (#490)
* 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>
2019-10-31 16:10:26 +09:00
Tóth Béla
2445b68221 Enable and move some v8 tests (#488)
Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-10-31 16:04:00 +09:00
Boram Bae
f11752b532 Update to support new.target with Class and eval (#489)
* Pass more tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-10-31 13:38:49 +09:00
Boram Bae
015836c721 Add a ScriptClassConstructorFunctionObject and Fix some bugs (#483)
* pass more tests

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

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

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

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

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

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

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

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

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

* Reduce memory operations in Parsing

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

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

Enable corresponding v8 test: es6/string-endsWith

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-10-18 12:31:49 +09:00
Patrick Kim
be2e01a807 Update public API & Remove SandBoxStack (#469)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-10-18 09:40:00 +09:00
Hyukwoo Park
ba161d7459 Fix case when functions located in parameter list (#468)
* functions in parameter list are scanned instread of skipping it
* fix #236 issue

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

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-10-17 18:28:00 +09:00
Patrick Kim
ba4631ae02 Fix public API errors & fix bugs (#466)
* When evaluate for-in, we should call [[Enumerate]] function & we shouldn't literate symbols and non-enumerable names.
* In esprima, we need to reset lastUsingName on {open, close}Block

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-10-17 11:20:06 +09:00
kisbg
582c58c8fa Optimized and fixing executeEnumerateObject in ByteCodeInterpreter.cpp (#459)
Basically when we iterated an object's keys, it was not in ascending order.
Also when one of the keys enumerable was changed to false, it was still in the list.
Enabled one V8 test.

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2019-10-16 18:22:43 +09:00
Boram Bae
5b43165375 Fix various bugs detected from vendor tests. (#464)
* In Proxy's defineOwnProperty, set settingConfigFalse to true if desc has a [[Configurable]] field and if desc.[[Configurable]] is false
* Use a length properly according to spec at each sort implementations
* Ignore tests where the only reason for the test failure is an error message difference

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-10-15 17:17:51 +09:00
Patrick Kim
2b58f8282d Use special vector it has inline storage in esprima::Parser::parseBinaryExpression (#463)
* this special vector reduce malloc/free count on parseBinaryExpression

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

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

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

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-10-14 13:07:28 +09:00
Robert Fancsik
20a1704abe Reduce the size of ObjectPropertyName on x64 (#460)
Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
2019-10-14 10:49:18 +09:00
Boram Bae
b9bb171eac Fix some bugs related to Propertydescriptor and Array (#457)
* Create a property only when each field of desc presents at fromObjectPropertyDescriptor
* Add a ArrayIteratorPrototypeObject
* Call iteratorClose correctly at Array.from

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

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-10-11 15:32:04 +09:00
Tóth Béla
44e90a6b91 Implement the @@match well-known Symbol (#157)
Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-10-11 14:46:27 +09:00
Patrick Kim
87ca01b658 Implement indirect export, import (#453)
* Rename ambiguous variables names(src, source, fileName) into src, sourceCode
* Treat 'await' as keyword

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

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

Also enabled one V8 test.

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2019-10-08 10:17:50 +09:00
Boram Bae
069921b3b9 Fix some bugs related to Array and TypedArray (#450)
* Close iterator when throwing an error
* Clamp the Uint8ClampedArray value properly.
* pass more spidermonkey tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-10-08 09:37:31 +09:00
Robert Fancsik
81b8992775 Fix [[Get]] length operation for %TypedArray%.set routine (#449)
Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
2019-10-07 19:07:56 +09:00
Patrick Kim
eceffac4c4 Implement Direct {Import, Export} (#448)
* Rename ESCARGOT_OUTPUT=bin into shell and make shell_test for testing.
* Remove ESCARGOT_SHELL, -SCARGOT_STANDALONE and Rename ESCARGOT_ENABLE_VENDORTEST into ESCARGOT_ENABLE_TEST.
* Fix bug in PersistentRefHolder
* Add DebuggerStatementNode for preventing parsing error even if we cannot support
* Revise Platform layer for supporting es6 module
* Implmenent class constructor toString

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-10-07 13:11:03 +09:00
Robert Fancsik
89bb5e4c14 Fix the default sort compare function for %TypedArray%s (#445)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-02 09:12:53 +09:00
Boram Bae
67e18df5f3 Update uneval to handle Symbol (#444)
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-10-01 14:48:48 +09:00
Boram Bae
a12e36834c Fix some bugs and add newGlobal builtinFunction to run spiderMonkeyTC (#443)
* Use a byteLength when creating new TypedArray from another TypedArray.
* Keep the isLexicallyDeclaredBindingInitialization value when generating storeBytecode on ArrayPatternNode
* Pass more SpiderMonkeyTCs

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

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

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-09-26 16:34:01 +09:00
Tóth Béla
8334e67178 Enable es6 v8 tests (#441)
Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-09-26 15:24:49 +09:00
Robert Fancsik
8095a934d6 Add Proxy object support for several builtin operations (#435)
Related methods:
 - Array.isArray
 - JSON.stringify
 - JSON.parse
 - Object.prototype.toString

Also fixed some errors in the Promise builtin rotuines to enable more tests.

Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
2019-09-26 12:33:37 +09:00
kisbg
b3e8662953 Fixed null argument in builtinStringNormalize (#440)
also removed few test in V8 skip list

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2019-09-24 16:24:21 +09:00
Boram Bae
dd78fda084 Update syntax errors related to 'super' (#438)
* Pass more test262 tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-09-24 16:23:54 +09:00
Patrick Kim
a19b321a5f Implement for statement per-iteration block correctly (#437)
* we should replace block context before executing update expression in for statement
* merge ObjectDefineGetter, ObjectDefineSetter byte code into one code
* add some missed scan operation in parser

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-09-24 16:15:39 +09:00
Hyukwoo Park
6fa563c68e Update minor syntax errors (#436)
* add invalid hexadecimal escape sequence error
* lexical declaration cannot appear in a single-statement context
* ASTContext structures are divided into another file
* pass more test262 TCs

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-09-20 15:47:50 +09:00
Patrick Kim
742e6d29e1 Fix bugs & Implement missed ES6 features (#432)
* Reimplement finally block in try-statement.
* Replace `ReturnFunction`, `ReturnFunctionWithValue` bytecode with `End`.
* When for-of loop is exited by exception or break, we need to close iterator
* Don't add Return Statement in ByteCodeGenerator. We should add Return Statement in ScriptParser.
* Fix bug in yield expression.
* Implement add implicit class name on class expression.

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-09-20 14:01:36 +09:00
Hyukwoo Park
a02a2a0d32 Fix several parsing error checks to pass test262 TCs (#431)
* 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>
2019-09-19 10:38:00 +09:00
Boram Bae
329ef89081 Add a SuperGetObjectOperation (#430)
* 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>
2019-09-18 18:56:48 +09:00
Hyukwoo Park
23200a8ca9 Fix syntax error check for destructuring (#429)
* pass more test262 TCs

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-09-18 17:12:06 +09:00
Patrick Kim
2cc9e3d63f Pass more test262 testcases (#428)
* 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>
2019-09-17 15:27:09 +09:00
Boram Bae
eeabd56c34 Fix a bug related to Class (#427)
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-09-16 18:05:57 +09:00
Patrick Kim
2173fa4b25 Pass more test262 testcases (#426)
* 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>
2019-09-16 13:25:56 +09:00
Boram Bae
37d7da1df4 Use preferred tags at Intl (#425)
* Fix some bugs related to making substring of extensions

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-09-11 18:15:37 +09:00
Patrick Kim
c4f82fe5ee When evaluate assigment expression, we should resolve reference on leftside first (#424)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-09-11 17:00:19 +09:00
Hyukwoo Park
919b62c40e Fix syntax check of parameters for arrow function (#423)
* 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>
2019-09-11 10:25:00 +09:00
Boram Bae
80c09d05eb Implement ECMA-402 related functions (#422)
* 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>
2019-09-10 18:29:47 +09:00
Hyukwoo Park
c2352d1722 Fix Spread (#421)
* spread is allocated on an array object in advance to know the entire length of array when it is used in array initializer
* spread array is fixed fast mode array which means that Array.prototype could not affect any array operation of spread array
* pass v8 TCs

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-09-10 16:59:57 +09:00
Robert Fancsik
2f63e82521 Fix Object.getOwnPropertySymbols (#420)
This argument must be coerced to object according to the standard.

Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
2019-09-10 10:54:50 +09:00
kisbg
499a6118dd Implement the @@unscopables well-known Symbol (#277)
Co-authored-by: Robert Fancsik <frobert@inf.u-szeged.hu>
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2019-09-09 10:43:39 +09:00
Hyukwoo Park
d29851c294 Add conversion between ExpressionNode and PatternNode (#419)
* implement reinterpretExpressionAsPattern parsing method for conversion between ExpressionNode and PatternNode
* remove redundant modules in Patterns

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-09-09 10:14:25 +09:00
Patrick Kim
98d3c9c26e Fix class bugs (#418)
* 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>
2019-09-09 10:12:47 +09:00
Patrick Kim
f6e1e5d966 Implement additional properties of the String.prototype (#417)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-09-06 15:13:34 +09:00
Boram Bae
4becc316b4 Fix bugs related to Intl (#416)
* Pass more test262 tests
* Use only merge sort algorithms for stability

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-09-06 10:48:10 +09:00
Patrick Kim
f3c433b99d Fixup esprima (#415)
* Implement scanning `class` & add missed calling `parse class` on scanning
* Implement statementListItem function correctly
* Fix class initialization bug

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-09-05 20:44:15 +09:00
Patrick Kim
c7b40195f1 Implement TaggedTempleateExpression correctly (#413)
* Implement {parse, scan}templateLiteral
* Fix bug in raw value parsing in TemplateLiteral

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-09-05 12:44:48 +09:00
Hyukwoo Park
474b917ecb Fix some bugs in Patterns (#412)
* 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>
2019-09-05 12:44:09 +09:00
Patrick Kim
4432709661 Revise RegExp module (#411)
* 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>
2019-09-04 14:12:01 +09:00
Boram Bae
e1f00df04b Fix bugs related to Intl.NumberFormat and DateTimeFormat (#410)
* 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>
2019-09-04 09:58:58 +09:00
kisbg
389a6a8463 Minor fix - removed unnecessary ArrayObject cast (#406)
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2019-09-03 21:14:14 +09:00
Boram Bae
0119c72006 Fix bugs related to Intl (#409)
* Pass more test262 tests
2019-09-03 17:15:55 +09:00
Hyukwoo Park
c829029eae Fix a bug of variable declarations within patterns (#408)
* 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>
2019-09-03 17:14:20 +09:00
Robert Fancsik
1df4dcd1a8 Add fast paths for hasProperty internal method (#407)
Also the Object.[[Get]] method is modified to follow the standard requirements without recursion.

Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
2019-09-03 17:14:03 +09:00
Robert Fancsik
387a30267c Simplify isRegExpObject check (#399)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-02 20:26:59 +09:00
Boram Bae
147032bb80 Use hasProperty instead of get in ObjectEnvironmentRecord (#405)
* Pass more test262 tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-09-02 18:09:13 +09:00
Hyukwoo Park
46c6ffa8a2 Fix Patterns (#400)
* 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>
2019-09-02 16:05:01 +09:00
Patrick Kim
7d60431fef Fix build error on tizen (#404)
* Add tizen_obs x86_64 cmake file

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

* Update cmake files for tizen_obs build (#402)

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

* Fix build error on tizen

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-09-02 12:56:00 +09:00
Patrick Kim
91ce0c6127 Pass more tests in test262 (#403)
* 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>
2019-09-02 12:51:17 +09:00
Boram Bae
35bf5c2768 Implement IsCompatiblePropertyDescriptor and CompletePropertyDescriptor (#398)
* Pass more test262 tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-08-29 20:27:56 +09:00
Patrick Kim
b33e7df9a2 Implement MetaProperty(new.target) (#397)
* add some missed public api functions

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-29 20:26:20 +09:00
Patrick Kim
b656248ce4 Refactor code (#396)
* Revise hasProperty and apply it everywhere
* Add hasIndexedProperty for performance
* Change Object::nextIndex{Forward, Backward} double parameter types into int for performance
* in String.prototype.replace, Use test fast path correctly & use old method because newer method cannot support regexp correctly(old method is faster)

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-29 14:35:50 +09:00
Boram Bae
393792cae7 Move escargot internal tests to Samsung/js_vendor_tc repo (#395)
* 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>
2019-08-29 14:35:00 +09:00
kisbg
8ac5611152 Implement the @@replace well-known Symbol (#194)
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2019-08-28 20:03:22 +09:00
Boram Bae
c5081ab463 Fix bugs related to ProxyObject (#394)
* 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>
2019-08-28 13:59:15 +09:00
Patrick Kim
881a44e0fb Fixup generator (#393)
* 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>
2019-08-28 13:57:32 +09:00
Tóth Béla
7a52184fc5 Fix ProxyObject to call with proper Property type (#365)
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
2019-08-27 18:36:26 +09:00
Boram Bae
27695e20dd Fix bugs related to Date (#389)
* 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>
2019-08-27 13:24:43 +09:00
Patrick Kim
7b7a777f73 Fixup generator (#391)
* we can use let, generator together now.

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-27 12:44:36 +09:00
Hyukwoo Park
cc3f7deb8c Remove redundant parameter modules (#390)
* 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>
2019-08-27 10:40:30 +09:00
Hyukwoo Park
4a61f0f9b7 Implement lazy parameter initialization (#388)
* 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>
2019-08-23 19:21:14 +09:00
Patrick Kim
66bd235740 Remove c++ try-catch statement in interpreter function. (#387)
* separate ByteCodeGenerator::m_tryStatementCount into multiple items for implementing es6 generator

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-23 16:55:34 +09:00
Boram Bae
90240a18f8 Set the function name Implicitly (#386)
* Pass more test262 tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-08-23 16:55:10 +09:00
Patrick Kim
e3a8fba176 Migrate to new bdwgc 8.0 GCutil & use cmake on building gc (#385)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-21 18:14:36 +09:00
Hyukwoo Park
c51ba1bf0e Fix several modules in parser (#384)
* 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>
2019-08-21 15:16:05 +09:00
Patrick Kim
35d046e023 Optmize execution speed & Enable clang build test (#381)
* 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>
2019-08-21 15:04:46 +09:00
Boram Bae
c62885d607 Fix bugs related to Array built-in functions (#383)
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-08-21 13:55:18 +09:00
Hyukwoo Park
9257c9e22d Add defineOwnProperty api (#382)
* fix a typo in PointerValueRef::isObject too

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-08-20 14:00:50 +09:00
Boram Bae
0e249846db Enable passed test262 tests (#380)
* This is the result of running a full test262 tests based on the current master branch

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-08-20 13:09:21 +09:00
Patrick Kim
3c0a1cfddd Don't use heap allocated lexical environment if possible (#378)
- We should not heap allocated env on...
  * functions uses variable on upper function
  * functions have `typeof` operation
  * functions have unmapped arguments object
- Improve calling function performance by remove accessing vtable once in interpreter(from isCallable, call to just call)

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-20 10:41:06 +09:00
Boram Bae
8e4f170f3f Reimplement [[SetPrototypeOf]](V) and Object.setPrototypeOf(O, proto) according to 6.0 (#377)
* Don't throw type error with Reflect.setPrototypeOf
* Pass more test262 tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-08-19 16:52:09 +09:00
Patrick Kim
850fde59c2 Update testing environment (#376)
* Add timeout on Jenkinsfile
* Update status badge
* add max retry count on octane

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-19 13:20:59 +09:00
Boram Bae
9dc01183c1 Implement Reflect.ownKeys (#375)
* 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>
2019-08-19 11:27:15 +09:00
Patrick Kim
bffa9402b1 Optimize execution speed (#374)
* Set ALWAYS_INLINE flag for SmallValue <-> Value convertor function
* Implement ScriptGeneratorFunctionObject for remove if-statement in FunctionCall
* Remove calling Object::call in CallFunction, CallFunctionWithReceiver opcode
* if function uses global variable only, we should not use heap env for the function
* Don't use bitfield for ExecutionState::m_inStrictMode because we have only one flag at there.
* Remove useless submodules (test262-master, test262-harness)

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-19 11:23:23 +09:00
Zoltan Herczeg
9ff6ee34c5 Don't add empty function expression names to scopes. (#373)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-08-19 11:20:20 +09:00
Patrick Kim
b29a2272cd Fix Jenkinsfile for testing merged pr (#372)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-14 18:29:01 +09:00
Boram Bae
31dec6a7b9 Implement OrdinaryHasProperty (O, P), Fix some bugs in ProxyObject (#371)
* 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>
2019-08-14 18:25:35 +09:00
Patrick Kim
7910cd5bfd Enable jenkins for testing Pullrequest (#369)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-14 16:45:49 +09:00
seonghyun kim
4ed2fafb77 Add Jenkinsfile
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-14 14:10:05 +09:00
Patrick Kim
8855166418 Enhance develoment productivity (#366)
* 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>
2019-08-14 11:10:21 +09:00
Boram Bae
ea38d7d96e Implement an '[[OwnPropertyKeys]]()' internal method of Object and refactor some codes (#364)
* 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>
2019-08-14 09:47:36 +08:00
Hyukwoo Park
77731dda5e Add Proxy APIs (#363)
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-08-13 17:01:07 +09:00
Hyukwoo Park
c28a8f6858 Skip the parsing of arrow function body in scan mode (#362)
* 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>
2019-08-13 17:00:38 +09:00
Patrick Kim
ad0cecbd0d Implement lazy-creation of arguments object. (#361)
* Store ArgumentsObject into Env record with functionObject
* Introduce gc memory leak checker
* Don't save stack pointer in ArgumentsObject

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

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-08-12 14:02:27 +08:00
Boram Bae
60b9d39046 Update test262 runner to exclude a specific test case (#359)
* Enable passed test262's test

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-08-09 13:53:05 +09:00
Patrick Kim
3bc6cb5cca Don't store argc, argv on FunctionEnvironmentRecord. (#358)
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>
2019-08-09 13:52:17 +09:00
Patrick Kim
864973236d Refactoring source code (#356)
* Remove some unused function, variables
* Remove LexicalEnvironment from NativeFunctionObject
* Don't save stack-allocated LexicalEnvironment on ScriptFunctionObject. it may cause memory leak from stack
* Don't store newTarget, ThisBinded value on FunctionEnvironmentRecord if possible(we don't need these values except class functions)

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-08 12:20:19 +09:00
Boram Bae
b516156eb7 Fix minor bugs (#357)
* 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>
2019-08-08 10:39:15 +09:00
Zoltan Herczeg
252a11fc96 Remove label check during byte code generation. (#354)
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
2019-08-08 09:54:43 +09:00
Robert Fancsik
2113ddd673 Fix arrow function bugs related to lazy instantiation (#353)
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
2019-08-08 09:53:39 +09:00
Tóth Béla
490ebcd6c8 Fix getValueFromArraybuffer calls to use proper type (#274)
Fixes: #225

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-08-07 15:09:40 +09:00
Boram Bae
de65761ac7 Implement GeneratorFunction constructor (#350)
* Fix some bugs
* Pass more test262 tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-08-06 22:12:49 +09:00
Patrick Kim
8c1cd3b2b5 Make to run test cases faster (#351)
* 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>
2019-08-06 18:55:48 +09:00
Hyukwoo Park
6156f7a695 Minor fix about ArgumentsObject::defineOwnProperty method (#349)
* fix double checks into one check statement
* enable more test262 test cases

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-08-06 14:24:32 +09:00
Hyukwoo Park
49266b6c9f Create rest parameter through bytecode interpretation (#348)
* 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>
2019-08-06 13:38:25 +09:00
Patrick Kim
43f442c560 Revise function call processes (#347)
* Revise [[call]], [[construct]] as described in spec
* Remove m_homeObject in FunctionObject.
* Implement ScriptClass{Constructor, Method}FunctionObject
    this subclass is used for saving [[homeObject]] and implement [[call]], [[consturct]]
* Add more(NewTargetBinder, ReturnValueBinder) into FunctionObjectProcessCallGenerator
* Remove feCounter in ByteCodeGenerationProcess. in ES6, function expression order & evaluation order can differ
* Add CallSuper ByteCode for interpret `super()` in class constructor
* Remove isOngoingSuperCall in ExecutionState
* Remove BuiltinFunctionObject. that was unnecessary

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-06 09:58:06 +09:00
Boram Bae
467841c5df Fix bugs related to GeneratorFunction and Pass more test262 tests (#346)
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-08-02 14:55:44 +09:00
Zoltan Herczeg
8708e4202c Only loops with label can be target of continue statement with label. (#345)
Note: a loop can have multiple labels.

Fixes #330.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-08-02 14:45:55 +09:00
Patrick Kim
356a103466 Separate FunctionObject (#344)
There are so many features in FunctionObject. so I separate FunctionObject into multiple classes.
  * Implement FunctionObjectProcessCallGenerator class for generate processCall code for each derived FunctionObject and implement [[call]], [[construct]] separately
  * Implement NativeFunctionObject, BuiltinFunctionObject for process NativeCall separately
  * Implement ScriptArrowFunctionObject for process `this` separately
  * TODO : ScriptClassMethodFunctionObject, ScriptGeneratorFunctionObject.

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-01 11:30:40 +09:00
kisbg
48a2191b00 Enable passed v8 test-cases (#341)
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2019-08-01 11:30:12 +09:00
Boram Bae
0659a09057 Adds more EscargotPublic APIs. (#342)
* ValueRef::isPointerValue()
* ValueRef::asPointerValue()
* ValueRef::abstractEqualsTo(ExecutionStateRef* state, const ValueRef* other) const
* ValueRef::equalsTo(ExecutionStateRef* state, const ValueRef* other) const
* Use a toImpl if possible

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-07-31 19:38:41 +09:00
Boram Bae
d5de5f81fd Adds Set and WeakSetPrototypeObject and Pass more test262 tests. (#340)
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-07-31 13:11:00 +09:00
Hyukwoo Park
af42a80f6b Rework ArgumentsObject based on ES2015 (#334)
* 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>
2019-07-31 12:38:20 +09:00
Boram Bae
aedb6b490a Pass more test262 tests (#339)
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-07-30 18:08:03 +09:00
Zoltan Herczeg
f3756eba87 Use a single memory block for Identifier nodes in for statements. (#338)
Several calls for alloca can be costly and may consume a lot of stack.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-07-30 18:07:39 +09:00
Patrick Kim
876fd29b34 Improve performance (#337)
* Optmize String.protype.split function.
  when separator comes to RegExpObject split function, we have to call @@split function when there is a @@split function.
  old one is correct implementation but performance is bad...
  but we already have optmized split function with RegExp in builtinStringSplit.
  I make to use old one when if user didn't defined own @@split function.
  RegExp test score is changed from 57 to 280 in my computer.

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

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-07-30 18:07:13 +09:00
Boram Bae
aa02a5c21c Add Object.is and pass more tests (#336)
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-07-30 11:07:33 +09:00
Patrick Kim
4de5ab5d2e Optmize ByteCodeInterpreter::setObjectPreComputedCaseOperationCacheMiss function (#333)
we can avoid searching propery name on ObjectStructure

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

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-07-26 13:16:44 +09:00
Roland Takacs
01521d2c0e Don't update the inlineCache if the referred property is removed. (#332)
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>
2019-07-26 09:50:58 +09:00
Boram Bae
2677e970f9 Fix some bugs related to ES6 and memory (#328)
* Pass more test262 tests
* Removes some unnecessary default structures
* Adds missing explicitly typed GC member at GeneratorObject

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-07-26 09:49:21 +09:00
kisbg
98d92c59ba Update README.md (#331)
Added cmake in prerequisites.

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2019-07-26 08:30:03 +09:00
Hyukwoo Park
f94e8fcd11 Fix ScanExpressionResult in parser to store AtomicString info (#326)
* 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>
2019-07-25 20:19:40 +09:00
Robert Fancsik
3b81c3e572 Optimize/simplify static string initialization (#324)
- 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
2019-07-24 18:16:41 +09:00
Hyukwoo Park
34867f39fe Enable rest element for arrow function (#322)
* Parser::groupExpression is fixed according to the esprima code
* passed two v8 TCs

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-07-24 10:11:29 +09:00
Boram Bae
c33bb2fb3c Enhance cmake build script and split travis jobs (#325)
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-07-23 15:01:11 +09:00
Boram Bae
042b6ac729 Enable passed test262 tests (#323)
* Splits travis jobs to avoid timeout caused by test262

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-07-22 20:36:32 +09:00
Boram Bae
392a9207c3 Add restricted function properties at Function.prototype (#320)
* Pass more TC in test262

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-07-22 10:22:04 +09:00
Hyukwoo Park
a81c864d05 Fix builtin constructor to creates a new object by itself (#319)
* 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>
2019-07-18 17:38:52 +09:00
Patrick Kim
d1b4ced24c Update lexcial environment. (#313)
- Store lexcial block informantion in InterpretedCodeBlock.
- If lexcial block has no lexcial variables, we should collapse the block.
- If there is no heap-allocated variables in lexcial environment, we can skip allocation of the environment.
- Implement Indexed storage for lexcial environment.
- Allocate lexcial variables in function stack storage if possible.

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-07-18 15:34:10 +09:00
Robert Fancsik
55649bc5b4 Improve String.prototype.repeat (#310)
- 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
2019-07-18 14:12:07 +09:00
Zoltan Herczeg
53a6249027 Enumerate Symbols for Freeze and Seal. (#317)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-07-18 10:00:03 +09:00
Patrick Kim
7eecb6fd37 Accept --engine command option correctly in tools/run-tests.py (#309)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-07-16 10:48:38 +09:00
Boram Bae
b64ca76d76 Fix a bug in Class's CreateMethodProperty (#315)
* Add a internal test

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-07-16 09:39:39 +09:00
Hyukwoo Park
55b6305736 Include TC driver files (#314)
* add TC driver files in tools/test
* to deal with enabling passed TCs easily

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-07-15 15:47:08 +09:00
Roland Takacs
bc29e285e4 Remove unused template string member of TemplateOperation opcode. (#311)
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>
2019-07-12 12:43:13 +09:00
Robert Fancsik
ef59096112 Implement the lexical scoping (#285)
This patch introduces the let and const keyword and all the related lexical scoping rules.

Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-05 13:38:11 +09:00
Boram Bae
8581b547b5 Fix a typedArray bug to have the correct value. (#306)
* Add a regression test
* Fixes #305

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-07-05 10:21:56 +09:00
Patrick Kim
c0c83ad0d6 Prepare for implementing es2015 specs (#304)
* Remove ES2015, PROMISE, PROXY, TYPEDARRAY defines
* Change test262 from 5.1 to 2015

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

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-07-04 15:17:27 +09:00
Boram Bae
9fdfe87fba Fix a Uint8ClampedAdaptor (#303)
* Also include a new regression test
* Fixes #273

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-07-04 10:30:49 +09:00
Hyukwoo Park
4e4dd698a5
Update submodule urls to Samsung org (#302)
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-07-03 16:00:43 +09:00
Hyukwoo Park
5e07db8a98 Fix travis config to update homebrew for macOS (#298)
* fix homebrew outdated error

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-07-03 15:44:21 +09:00
Hyukwoo Park
2b145ef54c
Update coding style guide (#296)
* reformat all single logical expression based on the new rule

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-07-03 15:42:41 +09:00
Boram Bae
4e6dd80542 Update a vendortest submodule (#299)
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-07-02 19:36:25 +09:00
Zoltan Herczeg
ebcd331fd8 Move m_generatorTarget into ExecutionStateRareData. (#293)
Also do some cleanup in ExecutionState.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-07-01 16:42:46 +09:00
Roland Takacs
88b4a94c25 Modify ByteCodeGenerator to have static member functions (#291)
Signed-off-by: Roland Takacs <rtakacs.uszeged@partner.samsung.com>
2019-07-01 16:41:59 +09:00
Hyukwoo Park
581cda4c55 Add construct api function for ObjectRef (#295)
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-06-26 11:04:16 +09:00
Patrick Kim
6b619d44c5 Move FunctionObjectRef::call function to ObjectRef. because some ObjectRef is Callable now (#294)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-06-21 11:32:17 +09:00
Hyukwoo Park
0671880845 Update isCallable check function according to call operation (#290)
* isFunction is replaced with isCallable check function
* call operations in Promise / TypedArray are fixed

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-06-19 16:51:30 +09:00
Patrick Kim
669bc3d37b Update submodule addresses (#292)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-06-19 16:50:59 +09:00
Hyukwoo Park
1dc3eb9977 Fix toPrimitive operation and use cases based on ES6 (#286)
* hint of toPrimitive operation is fixed
* invoke call operation instead of internal call method

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-06-19 10:52:27 +09:00
Zoltan Herczeg
91dc4ba8f7 Merge ExecutionContext and ExecutionState. (#281)
State without Context is rare, and the merged structure consumes less amount of memory.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-06-19 10:45:00 +09:00
Hyukwoo Park
106b9c8152 Revise bound function based on ES6 (#284)
* add BoundFunctionObject class to represent bound function object
* fix hasInstance operation according to ES6

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-06-13 13:02:39 +09:00
Patrick Kim
7f7f317340 Use explicit NullablePtr<T> type on public layer for user convenience (#283)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-06-11 14:19:21 +09:00
Hyukwoo Park
e4a8b22032 Revise call and construct operation based on ES6 (#278)
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-06-10 20:04:15 +09:00
Csaba Repasi
d4903ab642 Create toolchain files for the targets in CMake (#214)
This solution helps in the crosscompile.

Signed-off-by: Csaba Repasi repasics@inf.u-szeged.hu
2019-06-10 14:48:31 +09:00
Robert Fancsik
9166b2de38 Implement the generator functions (#270)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-06-10 11:55:14 +09:00
Patrick Kim
06d13b14ac Add isArrayPrototypeObject, isTypedArrayPrototypeObject on PointerValue (#282)
Add some missing methods in public layer

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-06-10 11:51:36 +09:00
Hyukwoo Park
8853bb4403 Merge IteratorStep and IteratorValue bytecodes (#279)
* IteratorValue can be replaced with IteratorStep
* it's better to keep the number of bytecode as small as possible

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-06-04 13:45:01 +09:00
Daniel Balla
f1e3df6832 Modify RegExp property getters, isRegExpObject check (#271)
Fixes `regexp-flags.js` testcase in v8.

Co-authored-by: Robert Fancsik <frobert@inf.u-szeged.hu>
Signed-off-by: Daniel Balla <dballa@inf.u-szeged.hu>
2019-05-29 14:44:03 +09:00
Peter Marki
bf0ebb6871 Update Array builtins with es2015 code path (#197)
Closes #191

Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-05-28 20:37:28 +09:00
Peter Marki
7eb5fe9901 Add Intl.getCanonicalLocales (#259)
Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-05-28 15:46:29 +09:00
Hyukwoo Park
151e30e24d Remove redundant GC objects in parsing (#261)
* unnecessary GC object/structure in parser removed
* explicitly represent stack-allocated object

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-05-28 13:53:40 +09:00
Hyukwoo Park
54f7a3503c Update coding convention (#272)
* coding rule is defined
* NULLABLE macro is added to represent any nullable pointer

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-05-27 15:44:28 +09:00
Peter Marki
a31ba9b127 Add Intl.Collator.prototype[@@toStringTag] (#256)
Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-05-24 13:21:20 +09:00
Zoltan Herczeg
34fa4f3d4f Reduce stack usage of the parser. (#269)
Inline CoverGrammar functions and move the common code into helper functions.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-05-23 17:31:49 +09:00
Roland Takacs
c3039c8b37 Simplify the OpcodeTable initialization. (#267)
Pass null pointers for ByteCodeInterpreter::interpret to indicate
the OpcodeTable initialization. In this case the FillOpcodeTable
opcode can be removed.

Signed-off-by: Roland Takacs <rtakacs.uszeged@partner.samsung.com>
2019-05-23 14:46:24 +09:00
Hyukwoo Park
6d7312579e Optimize memory allocation of Lexer based on the stack (#266)
* each ScannerResult is now allocated on the stack if it is really necessary
* reduce the reference count overhead for each ScannerResult
* ALLOC_TOKEN macro is newly added for allocation of each ScannerResult token

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-05-22 14:58:52 +09:00
Csaba Repasi
c426b1d688 Eliminate REGISTER_LIMIT based code duplications. (#268)
Signed-off-by: Csaba Repasi repasics@inf.u-szeged.hu
2019-05-22 11:22:21 +09:00
Daniel Balla
133bc131c8 Add ES6 RegExp.prototype.exec() method (#112)
Add ES6 support to RegExp.prototype.exec method.
Also fix regexp-lastIndex.js test in v8.

Signed-off-by: Daniel Balla <dballa@inf.u-szeged.hu>
2019-05-22 10:43:12 +09:00
Hyukwoo Park
aeb6851008 Fix minor bug & static analysis defect (#264)
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-05-21 11:22:02 +09:00
Peter Marki
a8d9fda7bf Add internal intl test directory (#260)
Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-05-17 18:38:29 +09:00
Zoltan Herczeg
5066b52687 Remove virtual from bindThisValue. (#258)
This function is used only in calls, and only available in FunctionEnvironmentRecord.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-05-17 18:38:12 +09:00
Peter Marki
c4ac0f37b9 Update RegExp default constructor to ES6 spec (#257)
Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-05-17 18:37:42 +09:00
Hyukwoo Park
fb0934f73b Update initialization of DateObject (#262)
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-05-17 18:37:08 +09:00
Peter Marki
dcc65eb937 Add Symbol.split well-known Symbol (#211)
Co-authored-by: Bela Toth tbela@inf.u-szeged.hu
Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-05-17 11:37:27 +09:00
Robert Fancsik
2e588a542b Implement patterns (#222)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-05-15 21:29:55 +09:00
Zoltan Herczeg
e9d3a9d6eb Simplify getPrototype. (#254)
The 0x1 value is not used by the engine.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-05-15 11:46:25 +09:00
Hyukwoo Park
3c6dee209b Fix bugs in for-of and iterator operation (#253)
* left should not be assignmentexpression in for-of statement
* this object for iterator operation fixed

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-05-14 18:42:21 +09:00
Peter Marki
4e1d74c2df Eliminate segfault when array changes to non-fast mode (#252)
Fixes #132

Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-05-14 17:42:29 +09:00
Hyukwoo Park
e0dd0a1e9c Fix travis configuration to wait for test262 (#249)
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-05-14 09:57:39 +09:00
Robert Fancsik
1fc56fcf9a Implement the class language element part II. (#203)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-05-14 09:10:13 +09:00
Patrick Kim
d9976037ce Arrow function can be used as argument (#250)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-05-13 20:10:09 +09:00
Robert Fancsik
837af8405f Optimize branch instructions and loop increment/decrement operations (#241)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-05-13 12:18:56 +09:00
Patrick Kim
1004220604 Implement ESCARGOT_TREAT_LET_AS_VAR env variable (#248)
This is bad implementation. but it is needed for some special reason

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-05-13 11:57:47 +09:00
Hyukwoo Park
10bf53ab8b Fix to use Marker instead of MetaNode in parsing of arrow function parameters (#247)
* scanner should be indexed on the relative position to the start position of each parsing unit, so Marker is used instead
* test cases for arrow-function are newly  added

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-05-13 11:39:25 +09:00
Daniel Balla
576720cdda Run test262 jobs only on ES5 builds (#217)
This patch fixes the 31 failures in test262 on travis which is caused by running the ES5 testsuite with ES6 build.

Signed-off-by: Daniel Balla <dballa@inf.u-szeged.hu>
2019-05-13 11:37:54 +09:00
Daniel Balla
94f8bfa24c Add missing checks for targetDescriptor in ProxyObject::get (#245)
Check if the descriptor is dataDescriptor / accessorDescriptor.

Signed-off-by: Daniel Balla <dballa@inf.u-szeged.hu>
2019-05-10 15:13:59 +09:00
Hyukwoo Park
02f356018c Fix bugs in Map and Set (#244)
* update the name of builtin size getter function
* Symbol.iterator property should not be enumerable

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-05-10 13:53:46 +09:00
Robert Fancsik
02d14eada3 Check returned ArrayBuffer in DataView buffer getter. (#243)
This patch fixes #135.

Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-05-10 13:52:26 +09:00
Zoltan Herczeg
0caf44d918 Remove tolerateError. (#246)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-05-10 13:20:36 +09:00
Hyukwoo Park
f1b465fc7e Fix timestamp (#242)
* Methods tickCount, longTickCount and timestamp returned invalid values
because of fact that timeval.tv_sec is only 32 bit value (long int).
* fix the timestamp according to the lightweight-web-engine

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-05-08 15:50:58 +09:00
Tóth Béla
69ae9be8d2 Reduce Code Smell issues (#221)
Rewamped a little bit of code, reported by SonarCloud for code smell.
Redudant parenthesis, and empty if statement code blocks.

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-05-08 13:57:15 +09:00
Roland Takacs
71ed729760 Add memory statistics feature to the project. (#220)
Added a boehm-gc heap usage monitoring feature to the project.
A runtim flag (--mem-stats) helps to show the collected informaion.

Renamed ESCARGOT_PROFILE_MASSIF to ESCARGOT_MEM_STATS in the CMake.
Of course, Valgrind based tools still can be used. In this case, the
project should be compiled with ESCARGOT_VALGRIND definition.

Signed-off-by: Roland Takacs <rtakacs.uszeged@partner.samsung.com>
2019-05-08 13:55:30 +09:00
yichoi
a063157898
Update GCutil submodule to get better profiling information (#240)
Signed-off-by: Youngil Choi <duddlf.choi@samsung.com>
2019-05-08 11:50:26 +09:00
kisbg
6e76ed1f06 fix - Assertion `s <= e' failed in Escargot::StringView::StringView (#238)
related #237

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2019-05-07 18:54:00 +09:00
Robert Fancsik
d788b0b3a9 Add default argument support for arrow functions (#228)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-05-07 18:53:49 +09:00
Peter Marki
bc7ed2ef68 Remove invalid cast to ArrayObject* in Array.prototype.concat (#239)
Fixes #235

Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-05-07 17:30:46 +09:00
kisbg
2c421b9673 minor optimization - Remove Object::get recursion (#231)
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2019-05-07 13:39:10 +09:00
Tóth Béla
31393f2a90 Fix ES6 octal literal parsing (#230)
The code had the place for parsing octal numbers like `0o543` and
`0O543`, but due to an implementation error the code returned with
`Unexpected token ILLEGAL`.

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-05-07 11:22:08 +09:00
Robert Fancsik
ddf9e7778c Fix the bytecode generation of the template literals quasis (#229)
This patch fixes #125.

Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-05-07 11:20:21 +09:00
Zoltan Herczeg
b0f1b83697 Make ScanExpressionResult to behave like an ASTNodeType. (#227)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-05-07 11:19:56 +09:00
Daniel Balla
321a0c700c Check ThisValue in regexp.prototype.compile (#226)
Fixes #223
Fixes #224

Signed-off-by: Daniel Balla <dballa@inf.u-szeged.hu>
2019-05-07 11:19:32 +09:00
kisbg
958b2935a1 CodeSmell - private members (#219)
https://sonarcloud.io/project/issues?branch=travisMoka&id=Achie72_escargot&resolved=false&rules=cpp%3AS3656&severities=CRITICAL

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2019-05-02 21:09:37 +09:00
Roland Takacs
a697595c3e Remove unused profiler code in CustomAllocator. (#218)
The code is deprecated and hasn't been used for a long time.

Signed-off-by: Roland Takacs <rtakacs.uszeged@partner.samsung.com>
2019-05-02 21:09:06 +09:00
kisbg
d8a1a174fb Minor optimization - bool flag (#215)
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2019-05-02 21:01:47 +09:00
Patrick Kim
d4fe34902d Support Clang with cmake (#216)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-05-02 09:38:31 +09:00
Robert Fancsik
cd03a086f1 Implement default arguments (#198)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-04-30 16:42:40 +09:00
Zoltan Herczeg
3ea072676c Remove string value from ScanExpressionResult. (#213)
Only Identifiers use it, so move it into a context member.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-30 12:07:55 +09:00
Zoltan Herczeg
bb90eb50e1 Merge parse/scan catchClause and finallyClause. (#212)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-26 13:39:24 +09:00
Peter Marki
56c247e3a2 Use a copied ObjectStructure in Object::enumeration (#209)
Fixes #128

Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-04-24 16:57:08 +09:00
Hyukwoo Park
8850b0103f Implement for-of statement (#205)
* merging for-of and for-in statement
* remove unnecessary bytecodes

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-04-23 15:29:40 +09:00
Patrick Kim
0d2d0bdaf2 Use std::mt19937 instead of rand() function for Math.random() builtin (#207)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-04-23 15:26:39 +09:00
Csaba Repasi
01ca240e83 Link libicu on ARM-Linux devices (#174)
ESCARGOT_LIBICU_SUPPORT build option have added:
If turned ON, then enable libicu. It turned ON by default.

In case of Linux host, libicu is only linked to Escargot on x86 and x64 architectures.
This patch helps to link libicu on ARM-Linux devices too, so linker problems can be avoided.

Signed-off-by: Csaba Repasi repasics@inf.u-szeged.hu
2019-04-19 12:08:40 +09:00
Zoltan Herczeg
11129d6c91 Merge parse/scan switchStatement, labelledStatement and throwStatement. (#204)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-18 19:55:05 +09:00
Hyukwoo Park
cf52d71269 Check memory consumption in octane benchmark (#200)
* update temporal memory consumption (Maximum resident set size) check in octane

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-04-17 11:20:22 +09:00
Zoltan Herczeg
b38439447d Merge parse/scan continueStatement, breakStatement and returnStatement. (#202)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-17 10:10:52 +09:00
Boram Bae
ff7f14ab2a Add a isDetachedBuffer method to ArrayBufferObjectRef (#201)
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-04-16 21:07:55 +09:00
Hyukwoo Park
b8d0e5c0f2 Update TypedArray builtin functions with SpeciesConstructor (#195)
* update constructor and subarray builtin functions of TypedArray

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-04-16 18:02:15 +09:00
Peter Marki
2a15e5b55d Add es2015 rest element (#192)
Co-authored-by: Robert Fancsik frobert@inf.u-szeged.hu
Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-04-16 12:01:30 +09:00
Ryan Choi
eed2a83b3c Fix build warnings in Android (#199)
Signed-off-by: Ryan Choi <ryan.choi@samsung.com>
2019-04-15 16:32:18 +09:00
Zoltan Herczeg
f92e1993ce Merge parse/scan doWhileStatement, whileStatement and forStatement. (#196)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-15 12:34:34 +09:00
kisbg
db3f4e94ec Implement the @@search well-known Symbol (#161)
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2019-04-15 12:33:58 +09:00
Robert Fancsik
ae28733902 Implement spread operator (#168)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-04-12 09:24:56 +09:00
yichoi
19c6721d2f
Update submodule by the reason of rollback of TC set (#193)
Signed-off-by: Youngil Choi <duddlf.choi@samsung.com>
2019-04-10 11:26:52 +09:00
Peter Marki
1f409e4ed5 Add length checks to Array prototype functions (#153)
Related issue: #124

Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-04-09 17:08:16 +09:00
yichoi
9a83e83b3f
Update GCUtil submodule to help track memory properly (#190)
Signed-off-by: Youngil Choi <duddlf.choi@samsung.com>
2019-04-09 11:26:03 +09:00
Zoltan Herczeg
36db704afe Merge parse/scan variableDeclaration, emptyStatement and ifStatement. (#189)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-09 10:22:00 +09:00
Hyukwoo Park
64ea29e82b Convert to non-fast-mode array when preventExtensions called (#186)
* first, convert to non-fast-mode and then, set non-extensible
* preventExtensions api is also updated

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-04-08 19:24:55 +09:00
yichoi
d24d19face
Ignore tracking modified contents in submodules (#187)
Signed-off-by: Youngil Choi <duddlf.choi@samsung.com>
2019-04-08 16:27:48 +09:00
Zoltan Herczeg
6c1c5f2d19 Merge parse/scan expression, statementListItem and block. (#183)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-08 14:12:05 +09:00
Peter Marki
95529f563d Implement the Symbol.species well-known Symbol (#140)
Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-04-08 14:11:36 +09:00
Seungsoo Lee
013368cfb3 Change std::list to vector type (#184)
I guess that "std::list" is not compatible to our GC.
So, while LWE is destroyed, std::list happens crash because of this issue.
So, I changed it to vector type.

Signed-off-by: Seungsoo Lee <seungsoo47.lee@samsung.com>
2019-04-08 09:54:59 +09:00
Hyukwoo Park
06a14e4496 Guard Object builtin functions which have conflicts between ES5.1 and ES6 (#182)
* update preventExtensions, freeze, seal, isExtensible, isFrozen, isSealed builtin functions

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-04-05 17:28:25 +09:00
yichoi
b25504ddea
Update GCutil submodule (#181)
Signed-off-by: Youngil Choi <duddlf.choi@samsung.com>
2019-04-05 12:18:51 +09:00
Hyukwoo Park
1c2ea5895c Fix issues of bind function (#179)
* bound function has no name
* fix the constructor operation of nested bind function

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-04-05 12:18:41 +09:00
Zoltan Herczeg
3d756cfed6 Merge parse/scan conditionalExpression and assignmentExpression. (#178)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-03 14:56:05 +09:00
Hyukwoo Park
41475227ee Fix instanceOf operation for bind function (#176)
* implement getting instanceOf handler part [es6]
* update instanceOf operation for bound function

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-04-03 14:55:55 +09:00
Zoltan Herczeg
d9d152dfa2 Merge parse/scan updateExpression and unaryExpression. (#175)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-02 14:13:46 +09:00
Roland Takacs
8a37c3ad68 Use default argument value in ByteCodeInterpreter::interpret() (#173)
Signed-off-by: Roland Takacs <rtakacs.uszeged@partner.samsung.com>
2019-04-02 14:12:43 +09:00
Hyukwoo Park
3f3366e1c4 Update of and copyWithin builtin method of Array (#172)
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-04-02 14:12:28 +09:00
Tóth Béla
47dce1c42b Merge collapsible if statements (#171)
Merged Collapsible if statements reported by SonarCloud.
Also unified some code in Lexer, to follow this ruleset.

https://sonarcloud.io/project/issues?branch=travisMoka&id=Achie72_escargot&resolved=false&rules=cpp%3AS1066&severities=MAJOR

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-03-28 16:53:51 +09:00
yichoi
e0a7e38ddd
Resolving Static Analysis Defect (Uninitialization of Constructor) (#170)
Signed-off-by: Youngil Choi <duddlf.choi@samsung.com>
2019-03-27 16:14:46 +09:00
yichoi
329ed6f1da
Resolving Static Analysis Defect (Uninitialization of Constructor) (#169)
Signed-off-by: Youngil Choi <duddlf.choi@samsung.com>
2019-03-27 14:07:56 +09:00
Hyukwoo Park
75b33faefb Update the rest of TypedArray builtin functions Part 5. (#167)
* filter, map, slice, sort builtin methods of TypedArray updated
* speciesConstructor, getDefaultTypedArrayConstructor and sort internal methods updated too

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-03-27 11:47:40 +09:00
Patrick Kim
1476a5ef11 Fix memory leak in Parser. (#166)
PassRefPtr::leakRef don't decrease refCount. but PassRefPtr::ctor increase refCount

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-03-26 20:39:48 +09:00
yichoi
611e28c1b6
Update GCUtil submodule for pando-project/gcutil#1 (#165)
Signed-off-by: Youngil Choi <duddlf.choi@samsung.com>
2019-03-26 20:39:22 +09:00
Hyukwoo Park
f495b887a1 Update Object.keys builtin method to translate argument based on ES6 (#164)
* argument O of keys method should be translated to an Object by ToObject builtin method

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-03-26 17:06:39 +09:00
Zoltan Herczeg
e228baf428 Merge parse/scan leftHandSideExpressionAllowCall and leftHandSideExpression. (#163)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-03-26 17:00:37 +09:00
yichoi
dc2b328ffa
Resolving Static Analysis Defect of SVACE (#162)
Signed-off-by: Youngil Choi <duddlf.choi@samsung.com>
2019-03-25 15:55:22 +09:00
Zoltan Herczeg
d9e877a35e Merge parse/scan groupExpression and newExpression. (#158) (#160)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-03-25 15:55:01 +09:00
Hyukwoo Park
cc546ca624 Update the rest of TypedArray builtin functions Part 4. (#159)
* from, of, get species builtin methods of TypedArray updated
* isCallable and isConstructor modified to commonly used in Value
* Symbol species also updated

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-03-25 15:54:30 +09:00
Zoltan Herczeg
087a3fc2d6 Merge parse/scan objectProperty and objectInitializer. (#158)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-03-22 13:35:40 +09:00
Robert Fancsik
d9005b7891 Improve dump messages for jump operations (#151)
Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
2019-03-22 13:35:14 +09:00
Robert Fancsik
291edc0a10 Merge ParseFunctionDeclaration and ParseFunctionExpression to reduce code duplication (#155)
Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
2019-03-20 16:24:30 +09:00
Hyukwoo Park
887b4ee864 Constructor initialization for GlobalObject (#156)
* to fix svace issue

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-03-20 16:21:09 +09:00
Boram Bae
e224d1d7d9 Add public API and fix a bug (#154)
* Add a setBuffer to ArrayBufferViewRef
* Initialize a m_uint8ClampedArrayPrototype correctly

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
2019-03-20 13:31:39 +09:00
Hyukwoo Park
2b95dc90bd Set the result value of SandBox::run to undefined when exception occurred (#152)
* when exception occurred, the result value of SandBox::run will never be used
* undefined value is allocated to avoid dereferencing of null pointer

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-03-20 13:31:16 +09:00
Zoltan Herczeg
728ca7cb0f Merge parse/scan pattern, spreadElement and arrayInitializer. (#150)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-03-20 13:30:27 +09:00
Hyukwoo Park
0b023f8143 Update NullablePtr implementation to include assert statement (#147)
* change to include assert guard code for getValue of NullablePtr
* when exception occurred, the result value is set to undefined which is never used but to avoid guard fail in NullablePtr

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-03-18 18:08:54 +09:00
Roland Takacs
27f91e3be9 Add profiler options for CMake. (#122)
Define PROFILE_BDWGC and PROFILE_MASSIF for the corresponding projects
and build the custom GCutil files (LeakChecker.cpp, Allocator.cpp) to
be able to profile the memory consumption.

Signed-off-by: Roland Takacs <rtakacs.uszeged@partner.samsung.com>
2019-03-18 17:26:31 +09:00
Daniella Barsony
4afdf61b2b Pass const primitive values by value rather than reference (#115)
Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2019-03-18 15:00:31 +09:00
Hyukwoo Park
d5eba8f75b Fix conversion to String for result value of SandBox run (#149)
* implement toStringWithoutException method not to throw any exception while converting to string value

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-03-15 20:09:11 +09:00
Zoltan Herczeg
beaa26988b Start merging parsing/scanning. (#148)
There is a lot of code duplication for parser and scanner.
Source code duplications can be reduced by templates without sacrificing performance.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-03-15 20:07:49 +09:00
Hyukwoo Park
82a10e89bc Update Iterator Operations (#146)
* implement getIterator, iteratorNext, iteratorComplete, iteratorValue, iteratorStep, iteratorClose, createIterResultObject method
* fix to correctly use iterator operations based on the ES2015 spec

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-03-15 20:05:21 +09:00
Robert Fancsik
e4dac958d0 Implement the class language element part I. (#141)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-03-15 19:59:39 +09:00
Robert Fancsik
2d7056e5a1 Simplify InterpretedCodeBlock initialization (#145)
Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
2019-03-14 12:03:06 +09:00
Zoltan Herczeg
b5e787f82a Unify reserved word checking. (#139)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-03-14 11:58:28 +09:00
Tóth Béla
5413d940b3 Remove Context-sensitive keyword from being an identifier (#142)
The C++ standard defines some identifiers as having special meaning in some contexts.
Final is one of these, and  while it is possible to use it as normal identifier,
it leads to a more clear code to consider only using these with their special meaning.

https://sonarcloud.io/project/issues?branch=travisMoka&id=Achie72_escargot&resolved=false&rules=cpp%3AS1669&severities=BLOCKER

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-03-13 13:06:17 +09:00
Peter Marki
f56e629bc9 Implement the @@isConcatSpreadable well-known Symbol (#121)
Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-03-13 12:59:10 +09:00
Daniel Balla
84dc59f389 Fix RegExp.prototype.toString() function (#118)
The function had a wrong behaviour expecting `this` value to be a RegExp Object.
However as the standard says `this` value should be an Object, and its `source` and `pattern` values' `toString()`s should be returned in a form of `/<source>/<flags>`.
Fixes #117

Signed-off-by: Daniel Balla <dballa@inf.u-szeged.hu>
2019-03-12 13:56:02 +09:00
Daniel Balla
3f65bb2e76 Add undefined native setter function (#138)
Added an undefined native setter to prevent nullptr dereference when calling the setter of an accessor property descriptor.
Fixes #130

Signed-off-by: Daniel Balla <dballa@inf.u-szeged.hu>
2019-03-11 12:02:41 +09:00
Robert Sipka
4b7720ce90 Check that the callee node pointer is not nullptr (#137)
Fixes #131

Signed-off-by: Robert Sipka <rsipka.uszeged@partner.samsung.com>
2019-03-11 12:01:09 +09:00
Hyukwoo Park
bd23e91f07 Minor update of NullablePtr (#136)
* fix build error to sync with lightweight-web-engine

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-03-11 12:00:34 +09:00
Zoltan Herczeg
3ed483090f Simplify error throwing in parser. (#134)
Remove unnecessary functions, simplify interface.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-03-11 12:00:06 +09:00
Hyukwoo Park
c50c7bc94e Update the rest of TypedArray builtin functions Part 3. (#133)
* some, toLocaleString, toString methods of TypedArray updated

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-03-08 10:19:40 +09:00
Hyukwoo Park
878482b563 Fix dereferencing a null pointer for ValueRef of EmptyValue (#108)
* NullablePtr is newly added to wrap a nullable pointer value
* Every ValueRef of EmptyValue should be accessed by NullablePtr

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-03-07 14:09:06 +09:00
Peter Marki
bfb1b7d6e0 Add internal es2015 test for the symbol type (#127)
Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-03-06 12:41:49 +09:00
Zoltan Herczeg
b7064e9569 Remove virtual methods of ByteCode. (#126)
To support snapshots in the future, ByteCode class should not have any virtual methods.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-03-06 12:41:35 +09:00
Tóth Béla
84df61d40b Reduce Cognitive Complexity in src/esprima.cpp (#113)
Reducing complexities reported by Sonarcloud, and refactoring possible later issue code.

https://sonarcloud.io/project/issues?id=pando-project_escargot&resolved=false&rules=cpp%3AS3776&severities=CRITICAL&sinceLeakPeriod=true&types=CODE_SMELL#

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-03-06 12:39:19 +09:00
Daniel Balla
0f4df2a46b Fix String.prototype.match() function to correctly change lastValue. (#120)
Fixes #119

Signed-off-by: Daniel Balla <dballa@inf.u-szeged.hu>
2019-03-05 09:57:45 +09:00
kisbg
02f462a481 Reduce code smell -Remove setPrototype method in constructor/destructor. (#109)
https://sonarcloud.io/project/issues?id=pando-project_escargot&resolved=false&rules=cpp%3AS1699&severities=CRITICAL&sinceLeakPeriod=true&types=CODE_SMELL

Signed-off-by: Bence Gabor Kis <kisbg@inf.u-szeged.hu>
2019-03-04 20:25:32 +09:00
Zoltan Herczeg
8fbf6d05ed Directly jump to the next opcode in the byte code interpreter. (#116)
Also fix misaligned lines.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-03-04 10:55:59 +09:00
Peter Marki
9f399d4682 Reduce cognitive code complexity of Scanner::ScannerResult::constructStringLiteral() (#111)
https://sonarcloud.io/project/issues?id=pando-project_escargot&issues=AWijtp3UBmaQb3-uIc8f&open=AWijtp3UBmaQb3-uIc8f

Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-02-28 14:07:09 +09:00
Zoltan Herczeg
6665d4caec Use size table for byte-code iteration. (#110)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-02-28 14:05:59 +09:00
Daniel Balla
69b94f98ab Add ES6 behaviour to Object.getPrototypeOf() (#107)
Also add ES6 macro guard to the function, and a build option for later implementation of ES6/ES5 differences in functions.

Signed-off-by: Daniel Balla <dballa@inf.u-szeged.hu>
2019-02-28 14:05:35 +09:00
yichoi
22584e42b4
Resolving Static Analysis Defects (#102)
Signed-off-by: Youngil Choi <duddlf.choi@samsung.com>
2019-02-26 16:13:46 +09:00
Zoltan Herczeg
6d2b73f818 Simplifiy punctuator parsing and introduce peekChar(). (#106)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-02-26 14:28:34 +09:00
Peter Marki
2ad365189d Use initializer lists where possible (#105)
https://sonarcloud.io/organizations/pando-project/rules?open=cpp%3AS3230&rule_key=cpp%3AS3230

Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-02-26 14:28:05 +09:00
Hyukwoo Park
d60fc706fd Clean up cmake build (#98)
* remove deprecated build options
* remove unnecessary quote symbols to improve readability

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-02-21 16:47:33 +09:00
Hyukwoo Park
92dff6a80c Update the rest of TypedArray builtin functions Part 2. (#104)
* forEach, join, reduce, reduceRight, reverse methods of TypedArray updated

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-02-21 13:29:18 +09:00
Roland Takacs
78eb42b5ae Use c++11 standard library instead of c++0x (#95)
Signed-off-by: Roland Takacs <rtakacs.uszeged@partner.samsung.com>
2019-02-21 13:28:56 +09:00
Hyukwoo Park
1328c113e5 Update the rest of TypedArray builtin functions Part 1. (#101)
* Array.prototype.fill method updated
* fill, find, findIndex methods of TypedArray updated
* TypedArray.prototype.every method is optimized to get a indexed property value more efficiently

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-02-20 16:21:21 +09:00
Zoltan Herczeg
69555d516a Remove HAS_OBJECT_TAG check. (#103)
It is enough to know whether a value is SMI or not.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-02-20 16:14:52 +09:00
Daniel Balla
26ee1718c5 Add RegExp.compile() function (#100)
This patch adds RegExp.compile() function.
Since the given argument can be a RegExp object as well, which already has their option flags parsed there was a need to add a new init function which doesn't parse flags and accepts an `unsigned int` as its parameter.

Signed-off-by: Daniel Balla <dballa@inf.u-szeged.hu>
2019-02-20 16:14:31 +09:00
Daniella Barsony
56b7748c67 Reduce code smells (#82)
Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2019-02-19 15:48:48 +09:00
Peter Marki
250d95d381 Fix bytecode generation for var statements in for-in statements (#52)
Fixes #29

Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-02-19 15:48:14 +09:00
Tóth Béla
5572e2b7de Reduce the rest of the member visibility code smell (#99)
Contains the fix for the rest of the member visibility reports from Sonarcloud.

https://sonarcloud.io/organizations/pando-project/issues?open=AWfKGekKAVFeC0PaKxib&resolved=false&rules=cpp%3AS3656

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-02-18 12:24:57 +09:00
Zoltan Herczeg
ed21c68ba6 Primitive types should use the same representation for Value and SmallValue (#92)
* Primitive types should use the same representation for Value and Small Value.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com

* An attempt to x86-32 (Will be merged if works).

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-02-15 13:51:34 +09:00
Tóth Béla
dab095397d Extract assignment from sub-expressions (#97)
Sonarcloud reported an issue, namely `Assignments should not be made
from within sub-expressions. This affected only the Lexer, and were fixed.

https://sonarcloud.io/project/issues?id=pando-project_escargot&resolved=false&rules=cpp%3AAssignmentInSubExpression&sinceLeakPeriod=true&types=CODE_SMELL

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-02-15 13:46:20 +09:00
Roland Takacs
d4979e1718 Eliminate the memory copier code duplications in the Vector classes. (#96)
Introduced a new template VectorCopier class that has specializations
for the `memcpy` and the `copy constructor` cases.

Signed-off-by: Roland Takacs <rtakacs.uszeged@partner.samsung.com>
2019-02-15 13:46:10 +09:00
Hyukwoo Park
ac5c7790b8 Enable Proxy and Reflect with internal TC (#88)
* enable proxy and reflect features in default
* add internal TC
* vendortest is updated to avoid stack overflow error in v8 TC

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-02-14 11:28:08 +09:00
Tóth Béla
80576ba08c Reduce code smell around member access - Runtime (part1) (#90)
First part of the code smell reducing in src/runtime.

https://sonarcloud.io/organizations/pando-project/issues?open=AWfKGekKAVFeC0PaKxib&resolved=false&rules=cpp%3AS3656

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-02-14 09:07:35 +09:00
Tóth Béla
5815a11ff3 Reduce code smell around member access - AST (part2) (#89)
Second part of the code smell reducing in AST.

https://sonarcloud.io/organizations/pando-project/issues?open=AWfKGekKAVFeC0PaKxib&resolved=false&rules=cpp%3AS3656

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-02-14 09:07:10 +09:00
kisbg
145ee3da98 Change check-tidy.py default clang format (#86)
When installing clang-format with sudo , its not installing automatically Clang-format-3.8,
but Clang-format-3.9 is installed instead.
Also the code formatting in src/runtime/GlobalObjectBuiltinRegExp.cpp update to Clang-format-3.9.

Signed-off-by: Bence Gabor Kis <kisbg@inf.u-szeged.hu>
2019-02-14 09:05:04 +09:00
kisbg
21cd2bd2d6 Reduce code smell - explicit (#83)
"explicit" should be used on single-parameter constructors and conversion operators

https://sonarcloud.io/organizations/pando-project/issues?resolved=false&rules=cpp%3AS1709

Signed-off-by: Bence Gabor Kis <kisbg@inf.u-szeged.hu>
2019-02-13 08:21:40 +09:00
Zoltan Herczeg
29ac4731c9 Move white space and new line checkers into the Lexer. (#81)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-02-13 08:19:28 +09:00
Tóth Béla
110e9c2e94 Reduce code smell around member access - AST (part1) (#85)
First part of the code smell reducing in AST. The directory contains
many more files, so i thought it'd be a good idea to seperate them into smaller
chunks to make code review easier.

https://sonarcloud.io/organizations/pando-project/issues?open=AWfKGekKAVFeC0PaKxib&resolved=false&rules=cpp%3AS3656

Signed-off-by: Bela Toth [tbela@inf.u-szeged.hu](mailto:tbela@inf.u-szeged.hu)
2019-02-12 10:16:24 +09:00
Tóth Béla
8f710b804e Reduce code smell around member access (#84)
This first part is smaller, due to following reports almost all beeing in a distinct subdirectory
of these, so i wanted to avoid mixing those in. This seems a proper logical dividing point for me.
https://sonarcloud.io/organizations/pando-project/issues?open=AWfKGekKAVFeC0PaKxib&resolved=false&rules=cpp%3AS3656

Signed-off-by: Bela Toth <tbela@inf.u-szeged.hu>
2019-02-12 10:16:05 +09:00
Zoltan Herczeg
f09fba8cce Remove OctalToDecimalResult from Lexer. (#80)
Instead use a special value to represent invalid octal values.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-02-12 10:12:03 +09:00
kisbg
54fea51393 Replace this "throw()" clause by "noexcept" in CustomAllocator.h (#79)
https://sonarcloud.io/organizations/pando-project/issues?resolved=false&rules=cpp%3AExceptionSpecificationUsage

Signed-off-by: Bence Gabor Kis <kisbg@inf.u-szeged.hu>
2019-02-12 10:11:37 +09:00
Hyukwoo Park
dbccca6f3a Update Reflect object and internal methods [es2015] (#78)
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-02-11 15:49:16 +09:00
Hyukwoo Park
fa96ce1f18 Fix travis error when merged into the master branch (#73)
* allow longer running time for test262 and chakracore
* move darwin test to allow_failure

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-02-01 15:26:08 +09:00
Zoltan Herczeg
dc30cd3035 Move ScannerResult into Scanner. (#77)
This way several functions can be moved into the private section.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-01-31 18:16:26 +09:00
Hyukwoo Park
871829c0fa Fix setPrototypeOf method of Object and Proxy (#76)
* fix setPrototypeOf internal method according to the es2015 spec

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-01-31 18:16:17 +09:00
Peter Marki
90ba62d6aa Check for assignment to self in operator=() functions (#72)
Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-01-31 13:31:14 +09:00
Zoltan Herczeg
5d5162ccca Remove tolerant parsing. (#75)
A JS engine must not accept an invalid JS code so tolerant
parsing is removed from the parser and configuration.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-01-30 14:47:57 +09:00
Zoltan Herczeg
a82b41313b Introduce private section for Lexer. (#74)
Start hiding private helper functions from outside world. Next step
will be hiding private data members.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-01-30 14:47:42 +09:00
Hyukwoo Park
f943931488 Update Revoke and Revocable method of Proxy (#69)
* Implement Proxy.revocable inner method
* Implement revocation builtin function object

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-01-30 14:47:28 +09:00
Hyukwoo Park
28e0345d42 Update TC list to make travis run fast (#70)
* merge each -DVENDORTEST build test onto one release build test
* exclude jetstream-only-simple and octane test from darwin due to excessively long running time

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-01-28 14:19:46 +09:00
kisbg
2034046a00 Updating the prerequisites (#68)
Signed-off-by: Bence Gabor Kis <kisbg@inf.u-szeged.hu>
2019-01-28 14:18:56 +09:00
Robert Sipka
6d0d69a0cb Do not call generateStatementByteCode for RegExpLiteral node in for statement (#65)
Fixes #35

Signed-off-by: Robert Sipka <rsipka.uszeged@partner.samsung.com>
2019-01-24 14:21:27 +09:00
Zoltan Herczeg
56868385e1 Remove CharOrEmptyResult structure. (#63)
Introduce EmptyCodePoint constant to represent the empty case.
Also hex conversion is simplified.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-01-24 14:20:36 +09:00
Hyukwoo Park
3dec40df2e Support Method Property in Object Initialization [ES2015] (#67)
* Support for method notation in object property definitions

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-01-23 14:06:37 +09:00
Akos Kiss
d7aa053de0 Allow octane tests to run longer in macOS CI jobs (#66)
Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>
2019-01-23 14:06:12 +09:00
Hyukwoo Park
9a9b376229 Update Call and Construct method of Proxy (#64)
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-01-23 14:05:30 +09:00
Robert Sipka
78095de75a Fix the function declarations in catch statement (#61)
Use dynamic allocation for IdentifierNode to prevent early destructor call.

Fixes #27

Signed-off-by: Robert Sipka <rsipka.uszeged@partner.samsung.com>
2019-01-23 14:04:20 +09:00
Peter Marki
16010c33e1 Throw exceptions by value and catch by reference (#62)
Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-01-23 11:50:52 +09:00
Zoltan Herczeg
de84be2e9e Remove curlyStack structure. (#59)
Instead of maintaining a structure in memory simply re-scan the
right brace when a template is parsed.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-01-22 18:15:17 +09:00
Daniel Balla
c21afcb74b Fix wrong behaviours in Promise.race() and Promise.All() functions (#57)
The assertions were wrong, if the given `iterable` was not an `Object` or not an `ArrayObject` the promise should have been just rejected.
Fixes #25
Fixes #30

Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2019-01-22 14:07:59 +09:00
Robert Sipka
0ece5de077 Add missing regression test for issue-26 (#58)
Signed-off-by: Robert Sipka <rsipka.uszeged@partner.samsung.com>
2019-01-22 10:35:58 +09:00
Zoltan Herczeg
57b75326d4 Rework isIdentifierPartSlow. (#56)
The new code uses a binary search instead of a very large if statement.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-01-21 12:24:38 +09:00
Robert Sipka
93c2de5435 Evaluate function declarations in catch statements properly (#54)
Fixes #26

Signed-off-by: Robert Sipka <rsipka.uszeged@partner.samsung.com>
2019-01-21 12:23:10 +09:00
Hyukwoo Park
40d4fa40c6 Implement Proxy object internal methods (#39)
* updated proxy methods
GetPrototypeOf
SetPrototypeOf
IsExtensible
PreventExtensions
GetOwnProperty
DefineOwnProperty
HasProperty
Get
Set
Delete
ProxyCreate

* TODO
Enumerate and OwnPropertyKeys
Call and Construct

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-01-21 12:22:40 +09:00
Daniel Balla
7d320870d7 Add regression tests (#41)
Now regression tests for resolved issues can be added to the project.
Regression tests are enabled by default.
They can be manually run by appending `regression-tests` to the `run-tests.py` command.
There is an `expected-failures` directory for tests that should fail.
The .gitignore file was modified as well to making sure it doesn't ignore these testfiles.

Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2019-01-21 10:23:07 +09:00
Zoltan Herczeg
09b45e47b4 Move Lexer (Scanner) out of parser. (#55)
Currently the parser is a very large file and hard to maintain. This patch is
the first which splits it into smaller files.

During the move some style fixes are applied. The identifer start
detection is improved as well.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-01-17 15:36:14 +09:00
Daniel Balla
b7f9750f96 Fix an issue with Object Property Descriptors (#53)
Pass an undefined value as Property Descriptor's `value` property if the previous descriptor's value was not present.

Co-authored-by: Robert Fancsik <frobert@inf.u-szeged.hu>
Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2019-01-17 15:36:05 +09:00
Hyukwoo Park
2535885050 Update missing builtin functions of String (#50)
* Implement repeat and normalize
* normalize function exploits unicode normalization forms

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-01-14 13:57:29 +09:00
Peter Marki
9a313f36bf Handle exceptions thrown by toString() when trying to convert an uncaught error (#42)
Fixes #36

Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-01-10 17:38:57 +09:00
Akos Kiss
c0b2202ecb Rework and improve check_tidy.py (#47)
- Add proper command line interface.
- Extend logging and coloring.
- Refactor and improve control structures, file I/O, and diffing.
- Fix exit code to signal failure in case of errors.
  (This has been a long-standing issue affecting CI not blocking
  format errors, as reported in #16.)

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>
2019-01-10 17:37:32 +09:00
Robert Sipka
aca603a7eb Do not get the object property descriptor`s value if it is not present (#45)
Fixes #28

Signed-off-by: Robert Sipka <rsipka.uszeged@partner.samsung.com>
2019-01-10 14:01:42 +09:00
Hyukwoo Park
d6e7c471a7 Update missing builtin functions of TypedArray (#49)
- Implement copyWithIn and every

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-01-09 17:19:37 +09:00
Akos Kiss
3dc7e349d0 Move to addon-based dependency installation and drop sudo requirement on Travis CI (#48)
It especially helps the darwin jobs: on macOS, the dependeny
installation via 'manual' brew invocation takes about 4.5 mintes,
while the Homebrew addon brings that down to cca. 10 seconds.

Addons remove the need for `sudo: required`. But it is not replaced
with `sudo: false` as the whole `sudo` key has been deprecated. So,
it is simply removed.

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>
2019-01-08 12:26:46 +09:00
Akos Kiss
d0f6c93f18 Make tests run on macOS (#43)
* Change V8 test runner not to compare whole test execution logs

When running V8 tests on macOS, the test runner reported failure
although the logs have clearly shown that all tests passed. It has
turned out that a single line of text was 'missing' from the logs:
"No connection to distribution server; running tests locally."

This has revealed the following problems:
- On macOS (actually, on anything non-Linux), "network distribution"
  is disabled early on and test script doesn't get to check for
  distribution server. So it cannot print that line in the logs
  either.
- Our test framework shouldn't try network distribution at all, not
  even on Linux.
- The outcome of the V8 test execution is determined by comparing
  the whole test execution log to a reference log with no
  difference allowed. However, the reference log cannot be updated
  (at least it's hard as it's in a submodule).

This commit
- adds the `--no-network` flag to the test script to prevent
  network distribution attempts in the future and to make all
  platforms behave the same, and
- replaces the outcome test from a log diff to a 'grep' for an
  "All tests succeeded" message.

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>

* Add nodejs detection to SpiderMonkey test runner

Node.js is only available as `nodejs` on some older systems while newer
platforms either symlink that to `node` or don't provide the tool by the
old name at all. (Homebrew-installed Node.js on macOS falls into the
latter category.)

To support all platforms, this commit adds a detection logic to the
SpiderMonkey test runner and uses the command that's available on the
system.

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>

* Make Travis CI run tests for macOS, too

Note: For now, chakracore and spidermonkey tests are disabled for
macOS as they would need fixes outside this repository.

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>

* Reorder Travis CI jobs to reduce total run time

The darwin.x64.release job is considerably slower than its linux
counterpart. Moreover, right now the darwin jobs are the last to
execute. The result of this is that most of the jobs have long
finished but the single longest running job (darwin.x64.release)
still has to be waited for.

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>
2019-01-07 17:17:16 +09:00
Akos Kiss
1e988528f7 Simplify code paths and fix style issues in Object::defineOwnProperty (#46)
- Merged `if (A) { if (B) {} }` constructs into `if (A && B) {}`.
- Rewrote simple if-else's to `?:`.
- Reorganized if's not to re-test conditions.
- Added some missing braces to single-statement branches of if-else's.
- Fixed the indentation of some comments.

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>
2019-01-07 14:48:51 +09:00
Peter Marki
12525b5149 Handle TypedArrays as regular objects instead of array objects in builtinJSONStringify (#38)
Fixes #31

Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-01-04 11:34:40 +09:00
Daniel Balla
51f10cbe7b Remove unnecessary assertion in the ArrayObject's setArrayLength function (#34)
There's no need to put an assertion there because:
 - The ArrayObject's length can be changed even when it's not extensible, it just fills the Array with empty values.
 - Modifying the length of an ArrayObject should not throw an error, the only time it should when an element is pushed to a non-extensible ArrayObject.

Fixes #33

Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2019-01-04 11:34:25 +09:00
Akos Kiss
8f6925acc7 Fix warnings reported during compilation on macOS (#32)
* Use non-universal compiler options for gcc only

Compiler of macOS (clang) doesn't support all options currently
used. Optimization flags `-frounding-math` and `-fsignaling-nans`
are not supported, while warning options
`-Wno-unused-but-set-variable` and `-Wno-unused-but-set-parameter`
are unknown.

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>

* Remove deprecated register storage class specifier

The storage class specifier `register` was deprecated in C++11 (and
is incompatible with C++17, where the keyword is unused and
reserved).

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>

* Remove extraneous parentheses from around equality comparison

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>

* Don't use memcpy on PointerValue objects

Class `PointerValue` and its descendants are dynamic classes, their
instances have a vtable pointer. C functions like `memcpy` know
nothing about C++ classes and object memory layouts, so using
C-style memory access to C++ objects with vtable pointers makes the
compiler complain.

This patch replaces `memcpy` with a more C++-ish approach.

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>
2019-01-02 17:48:01 +09:00
Akos Kiss
1709a9e3cf Add support for Darwin (macOS) (#24)
* Fix whitespace issues in cmake files

- Remove trailing spaces from lines.
- Replace tabs with spaces.

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>

* Rename ESCARGOT_LIBDIRS to ESCARGOT_INCDIRS in cmake files

It was a misnomer as the variable contained include paths.

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>

* Add support for Darwin (macOS)

- The `malloc.h` header is Linux-specific, `stdlib.h` is the
  standard header to be used instead.
- The `librt.a` library contains the POSIX Advanced Realtime Option
  functions. MacOS does not have the library (but does not seem to
  need it either).
- The linker on MacOS does not support `--gc-sections`, an
  alternative is `-dead_strip`.

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>

* Add Travis CI job to build-test on macOS

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>

* Add macOS build instructions to README

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>
2019-01-02 17:47:38 +09:00
Akos Kiss
0fe35452cf Don't hardcode version into Sonar properties (#23)
Let git hash be the version property so that analysis results can
be mapped to code revisions. (Currenly, SonarCloud shows timestamps
only, which are not really natural identifiers for a git project.)

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>
2019-01-02 17:47:18 +09:00
Akos Kiss
7876ffb7dc Move ChakraCore test suite execution logic to run-tests.py (#22)
Follow-up to #18

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>
2019-01-02 17:36:53 +09:00
Akos Kiss
8bcf72ab61 Use ninja as native build system in Travis CI jobs (#21)
Also update build-related section of README.

Follow-up to #18

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>
2018-12-21 13:40:14 +09:00
Akos Kiss
4880919b95 Drop build/TestJS.mk and build/test.cmake (#20)
This removes the redundancy in test execution approaches and keeps
Python-based approach only.

The commit also updates the Testing section in README accordingly.

Follow-up to #18

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>
2018-12-21 13:40:04 +09:00
박혁우/Common Platform Lab(SR)/Staff Engineer/삼성전자
55e29beeae Fix code list in escargot.cmake (#184)
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2018-12-21 11:56:34 +09:00
Akos Kiss
71b268802e Minimize APT dependencies on Travis CI (#19)
Only install those packages, which are actually needed. This reduces
job startup/execution time (a bit).

Also update README to highlight which dependencies are mandatory and
which are optional.

Note: the libc++-dev dependency has been removed from Travis CI
config and README alike as it turned out not to be needed by any of
the builds.

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>
2018-12-21 09:29:17 +09:00
Akos Kiss
08130d5a40 Move test suite execution into a single dedicated runner script (#18)
Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>
2018-12-21 09:26:10 +09:00
Akos Kiss
a64a3e9145 Sync make- and cmake-based execution of the test262 suite (#17)
The excludelist.orig.xml file in the root directory of the project
is a leftover. Cmake-based system already uses the same file from
the test/ directory. The make-based system is updated to work alike.

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>
2018-12-21 09:25:08 +09:00
Akos Kiss
7c72ec9bc3 Fix format errors (#16)
Note: These errors are reported by check-tidy.py on Travis CI but
the job still completes successfully.

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>
2018-12-21 09:18:29 +09:00
Akos Kiss
7c2884103b Fix .travis.yml (#15)
Travis CI reports error and does not run jobs as it cannot parse the
YAML file.

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>
2018-12-20 20:32:11 +09:00
최영일/Common Platform Lab(SR)/Principal Engineer/삼성전자
a0614926f1 remove unnecessary directory (#182)
Signed-off-by: Youngil Choi <duddlf.choi@samsung.com>
2018-12-20 15:26:36 +09:00
Youngil Choi
f1a8e73c31 Enable SonarCloud on Travis
Signed-off-by: Youngil Choi <duddlf.choi@samsung.com>
2018-12-20 14:59:12 +09:00
박혁우/Common Platform Lab(SR)/Staff Engineer/삼성전자
f262360139 Update Ninja based build and test system (#181)
* now, build & test is executed by ninja
* make (Makefile) also can be used for build & test as before

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2018-12-19 09:17:32 +09:00
변무홍/Common Platform Lab(SR)/Staff Engineer/삼성전자
8036620c9a Remove packed option for android (arm) (#180)
Signed-off-by: MuHong Byun <mh.byun@samsung.com>
2018-12-19 09:17:22 +09:00
박혁우/Common Platform Lab./Staff Engineer/삼성전자
f3f0fdd73b Implement 'get' and 'set' for 'Proxy' (#106) (#179)
* also update vendortest to handle es6 features

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2018-12-18 09:54:02 +09:00
Akos Kiss
b1911d3d6d Some VENDORTEST-related macro guard cleanup in shell (#12)
Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>
2018-12-17 13:28:53 +09:00
Akos Kiss
76e91c8cf6 Fix V8 test execution (#11)
- Set longer timeout for V8 tests.
- Don't allow vendortest jobs to fail anymore.

Fixes #9

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>
2018-12-17 10:09:48 +09:00
김승현/Tizen Platform Lab(SR)/Engineer/삼성전자
df818da7b2 ENABLE INTL on windows port (#178)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2018-12-17 10:06:49 +09:00
Akos Kiss
c12d5c0efa Add Travis CI badge to README (#10)
Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>
2018-12-14 20:45:32 +09:00
박혁우/Tizen Platform Lab(SR)/Staff Engineer/삼성전자
3e38520aba Update CMake for ninja based build (#177)
* switch to ninja based build to unify the build environment with browser
* fix spidermonkey driver to run correctly without unimplemented ES6 feature

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2018-12-14 17:52:10 +09:00
Akos Kiss
daf3c6e18a Enhance cmake build system and Travis CI to run v8 and spidermonkey tests (#8)
Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>
2018-12-14 13:55:28 +09:00
Akos Kiss
e27d34d551 Factor tidiness check out from cmake files (#7)
Tidiness check is performed on the raw sources, it does not need
build artefacts. Actually, it does not even need build configuration
via cmake. Thus, there is no need to add custom tidy commands via
cmake files. This commit removes such custom commands.

The removal also allows factoring out the check on Travis CI into a
separate job, so that the same check does not have to be performed
in each build job.

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>
2018-12-14 09:27:16 +09:00
Akos Kiss
312564189f Add Travis CI configuration (#3)
* Add Travis CI configuration

* Remove inaccessible test submodules

* Reactivate test submodules with old but public urls and hashes

* Fix out-of-source-tree build

Ensure that `tidy` target starts looking for the python scripts in
the tools/ subdirectory of the project root.

* Change Travis CI to cmake-based build system

* Make test262 pass on Travis CI

The build/test system is still a mix: there are already
test262-related targets in cmake files but the test jobs on Travis
CI still use the hand-written makefile in root. The reason is that
the targets that exist in cmake files only exist when the project
is configured. However, configuration is lost across CI jobs. So,
this is something that should be cleared up later. It just works
for now.

* Build x86 targets on Travis CI

* Suppress printing compiler invocations during CI build to reduce noise

* Remove explicit invocation of build_third_party.sh during CI build

Let cmake handle that.

* Ensure that libicuNN:i386 is installed when x86 tests are run on CI

* Suppress unused variable warnings during GC build

The build of the GC is full of "'GC_jmp_buf' defined but not used"
warnings. However, as it is a third-party component and is rather
left unchanged, all we can do is suppress those warnings to reduce
the noise.

* Heavy refactoring of .travis.yml

Integrate build and test jobs for each ARCH.MODE target.

This makes caching across jobs unnecessary, thus it makes parallel
CI builds safer.

This also makes the CI more efficient as the cost of setting up
a new virtual machine for every job is reduced (from 25 to 4).

* Fix custom test targets to work with out-of-source-tree builds

And make use of them in Travis CI, i.e., use cmake-generated
makefiles instead of the hand-written global makefile when testing.
2018-12-13 10:55:14 +09:00
Youngsoo Son
448c2b455b Initialize Pando project
Signed-off-by: Youngsoo Son <ysoo.son@samsung.com>
2018-12-13 10:55:14 +09:00
Akos Kiss
dd80c1bd14 Make check_tidy.py work with Python 2 & 3 (#6)
Print without function call syntax does not work in Python 3.

Signed-off-by: Akos Kiss <akiss@inf.u-szeged.hu>
2018-12-13 10:54:29 +09:00
1022 changed files with 412660 additions and 45079 deletions

24
.ahub/sam/exclude.txt Normal file
View file

@ -0,0 +1,24 @@
# Exclude external third-party libraries
/escargot/third_party/double_conversion/double-conversion.cc
/escargot/third_party/double_conversion/bignum.h
/escargot/third_party/GCutil/
/escargot/third_party/libbf/libbf.c
/escargot/third_party/lz4/lz4.cpp
/escargot/third_party/rapidjson/include/rapidjson/document.h
/escargot/third_party/rapidjson/include/rapidjson/reader.h
/escargot/third_party/rapidjson/include/rapidjson/encodings.h
/escargot/third_party/yarr/
# Exclude parser/interpreter codes which have intensive control statements and similar patterns essentially used for compilation and execution
/escargot/src/parser/Lexer.h
/escargot/src/parser/Lexer.cpp
/escargot/src/parser/esprima_cpp/esprima.cpp
/escargot/src/interpreter/ByteCodeInterpreter.h
/escargot/src/interpreter/ByteCodeInterpreter.cpp
/escargot/src/parser/CodeBlock.h
# Exclude huge-scaled Object classes that represent built-in JavaScript Objects
/escargot/src/runtime/GlobalObject.h
/escargot/src/runtime/Object.h
/escargot/src/runtime/DateObject.h
/escargot/src/runtime/Value.h

View file

@ -1,36 +0,0 @@
/*
* vim: syntax=javascript
*/
{
/*
"presets":
[
["latest",
{ "es2015": { loose: true, modules: false} },
],
],
*/
"plugins":
[
["transform-es2015-block-scoping"], /* let */
["transform-es2015-constants"], /* const */
["transform-es2015-arrow-functions"], /* arrow */
["transform-es2015-destructuring"],
["transform-es2015-template-literals"], /* `foo${bar}` => "foo" + bar */
// ["transform-es2015-for-of"], /* Cannot support array[Symbol.iterator]() */
["transform-es2015-classes"],
["transform-es2015-shorthand-properties"],
],
"ignore":
[
"/JavaScriptCore/stress/resources/", /* Convert manually */
"/JavaScriptCore/stress/regress-159779", /* Too long */
],
"sourceType": "script",
}

5
.github/CODEOWNERS vendored Normal file
View file

@ -0,0 +1,5 @@
# This is a comment.
# Each line is a file pattern followed by one or more owners.
* @ksh8281 @clover2123 @bbrto21
/src/debugger/ @zherczeg

34
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View file

@ -0,0 +1,34 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---
**Escargot (please complete the following information):**
- OS: [e.g. Ubuntu 18.04]
- Revision [e.g. 958b293]
**Describe the bug**
A clear and concise description of what the bug is.
**Test case**
Test code to reproduce the behavior:
```js
```
**Backtrace**
```
```
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Additional context**
Add any other context about the problem here.

View file

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

88
.github/workflows/analysis-actions.yml vendored Normal file
View file

@ -0,0 +1,88 @@
name: Analysis
on:
schedule:
# trigger on every monday, wednesday and friday
- cron: '30 22 * * 1,3,5'
workflow_dispatch:
jobs:
coverity-scan:
if: github.repository == 'Samsung/escargot'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Build ICU(64)
run: |
git clone --depth 1 --single-branch -b release-78.1 https://github.com/unicode-org/icu.git $GITHUB_WORKSPACE/icu64-build/
cd $GITHUB_WORKSPACE/icu64-build/icu4c/source
LDFLAGS="-Wl,-rpath=$GITHUB_WORKSPACE/icu64/lib/" ./runConfigureICU Linux/gcc --prefix="$GITHUB_WORKSPACE/icu64/"
make -j8
make install
- name: Download Coverity Tool
env:
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
run: |
wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=Samsung%2Fescargot" -O cov-analysis-linux64.tar.gz
mkdir cov-analysis-linux64
tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64
- name: Build
env:
BUILD_OPTIONS: -DESCARGOT_MODE=release -DESCARGOT_THREADING=ON -DESCARGOT_TCO=ON -DESCARGOT_CODE_CACHE=ON -DESCARGOT_WASM=ON -DESCARGOT_TEMPORAL=ON -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON -DESCARGOT_OUTPUT=shell -GNinja
run: |
export PATH=$GITHUB_WORKSPACE/cov-analysis-linux64/bin:$PATH
LDFLAGS="-L$GITHUB_WORKSPACE/icu64/lib/ -Wl,-rpath=$GITHUB_WORKSPACE/icu64/lib/" PKG_CONFIG_PATH="$GITHUB_WORKSPACE/icu64/lib/pkgconfig/" cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H. -Bout/coverity_scan $BUILD_OPTIONS
cov-build --dir cov-int ninja -Cout/coverity_scan
- name: Submit
env:
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
NOTI_MAIL: ${{ secrets.COVERITY_SCAN_MAIL }}
run: |
tar czvf escargot.tgz cov-int
curl \
--form token=$TOKEN \
--form email=$NOTI_MAIL \
--form file=@escargot.tgz \
--form version="4.3.0" \
--form description="escargot coverity scan" \
https://scan.coverity.com/builds?project=Samsung%2Fescargot
coverage-scan:
if: github.repository == 'Samsung/escargot'
runs-on: [self-hosted, linux, x64, test]
timeout-minutes: 600
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Build x64
env:
BUILD_OPTIONS: -DESCARGOT_MODE=release -DESCARGOT_THREADING=ON -DESCARGOT_TCO=ON -DESCARGOT_COVERAGE=ON -DESCARGOT_TEMPORAL=ON -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON -DESCARGOT_OUTPUT=shell -GNinja
run: |
LDFLAGS=" -L/usr/icu78-64/lib/ -Wl,-rpath=/usr/icu78-64/lib/" PKG_CONFIG_PATH="/usr/icu78-64/lib/pkgconfig/" cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H. -Bout/coverage64 -DESCARGOT_ARCH=x64 $BUILD_OPTIONS
ninja -Cout/coverage64
LDFLAGS=" -L/usr/icu78-32/lib/ -Wl,-rpath=/usr/icu78-32/lib/" PKG_CONFIG_PATH="/usr/icu78-32/lib/pkgconfig/" cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H. -Bout/coverage32 -DESCARGOT_ARCH=x86 $BUILD_OPTIONS
ninja -Cout/coverage32
- name: Run test262 and collect coverage data
# test262 is unstable in actions env, but coverage data will be accumulated
continue-on-error: true
run: |
# set locale
sudo locale-gen en_US.UTF-8
export LANG=en_US.UTF-8
locale
LD_LIBRARY_PATH=/usr/icu78-64/lib/ GC_FREE_SPACE_DIVISOR=1 tools/run-tests.py --arch=x86_64 --engine="$GITHUB_WORKSPACE/out/coverage64/escargot" new-es regression-tests test262 octane chakracore sunspider-js modifiedVendorTest jsc-stress v8 spidermonkey intl jetstream-only-cdjs
LD_LIBRARY_PATH=/usr/icu78-32/lib/ GC_FREE_SPACE_DIVISOR=1 tools/run-tests.py --arch=x86 --engine="$GITHUB_WORKSPACE/out/coverage32/escargot" new-es regression-tests test262 octane chakracore sunspider-js modifiedVendorTest jsc-stress v8 spidermonkey intl jetstream-only-cdjs
- name: Generate coverage report
run: |
gcovr --gcov-ignore-parse-errors --exclude-unreachable-branches --exclude-throw-branches --exclude '.*third_party/' --exclude '.*shell/' --exclude '.*api/' -r . --xml coverage.xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: ./coverage.xml
name: codecov-umbrella
verbose: true

97
.github/workflows/android-release.yml vendored Normal file
View file

@ -0,0 +1,97 @@
name: Android-Release
on:
push:
tags:
- "v*.*.*"
jobs:
build-android-on-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up JDK
uses: actions/setup-java@v4.1.0
with:
distribution: "zulu"
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build with Gradle
working-directory: ./build/android
run: |
./gradlew bundleHostJar
./gradlew javadocJar
./gradlew sourcesJar
./gradlew :escargot:testDebugUnitTest
mv ./escargot/build/libs/escargot.jar ./escargot/build/libs/escargot-ubuntu.jar
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: build-artifact-ubuntu
path: |
./build/android/escargot/build/**/escargot-*.aar
./build/android/escargot/build/**/escargot-*.jar
!./build/android/escargot/build/**/escargot-*Shell.aar
if-no-files-found: error
build-android-on-macos:
runs-on: macos-15
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Packages
run: |
brew update
brew install ninja icu4c
- name: Set up JDK
uses: actions/setup-java@v4.1.0
with:
distribution: "zulu"
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build with Gradle
working-directory: ./build/android
run: |
./gradlew bundleHostJar
./gradlew :escargot:testDebugUnitTest
mv ./escargot/build/libs/escargot.jar ./escargot/build/libs/escargot-mac.jar
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: build-artifact-mac
path: |
./build/android/escargot/build/libs/escargot-mac.jar
if-no-files-found: error
merge-update-release:
needs: [build-android-on-ubuntu, build-android-on-macos]
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: build-artifact-*
merge-multiple: true
- name: Set release date
run: |
echo "RELEASE_DATE=$(date --rfc-3339=date)" >> $GITHUB_ENV
- name: Merge build artifacts
working-directory: ./artifacts
run: |
ls -R ./
echo ${RELEASE_DATE}
find . -type f -name "escargot-*.aar" -exec mv {} . \;
find . -type f -name "escargot-*.jar" -exec mv {} . \;
ls -R ./
find ./ -type f -name "escargot-*.aar" -o -name "escargot-*.jar" | zip Android-Release-${{ env.RELEASE_DATE }}.zip -@
- name: Upload to release
uses: softprops/action-gh-release@v2
with:
files: |
artifacts/Android-Release-${{ env.RELEASE_DATE }}.zip

110
.github/workflows/code-review.yml vendored Normal file
View file

@ -0,0 +1,110 @@
name: Review Bot (PR)
on:
pull_request_target:
types: [opened, synchronize, reopened]
branches: [ "master" ]
concurrency:
group: review-${{ github.event.pull_request.number }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
jobs:
review:
if: github.repository == 'Samsung/escargot'
runs-on: [self-hosted, escargot-review]
steps:
- name: Compute diff range (incremental on synchronize)
id: shas
uses: actions/github-script@v7
with:
script: |
const action = context.payload.action;
const pr = context.payload.pull_request.number;
const baseSha = context.payload.pull_request.base.sha;
const headSha = context.payload.pull_request.head.sha;
let base = baseSha;
let skip = false;
if (action === 'synchronize') {
const before = context.payload.before;
if (before) {
base = before;
} else {
skip = true;
}
}
core.setOutput('base', base);
core.setOutput('head', headSha);
core.setOutput('pr', pr);
core.setOutput('skip', String(skip));
- name: Skip review (no before on synchronize)
if: ${{ steps.shas.outputs.skip == 'true' }}
run: |
echo "[Review Bot] Skipping review: 'before' SHA missing on synchronize event."
- name: Call review server
id: call
if: ${{ steps.shas.outputs.skip != 'true' }}
env:
REVIEW_SERVER: ${{ secrets.REVIEW_SERVER }}
run: |
set -euo pipefail
REVIEW_SERVER="${REVIEW_SERVER}"
BASE_SHA="${{ steps.shas.outputs.base }}"
HEAD_SHA="${{ steps.shas.outputs.head }}"
PR_NUMBER="${{ steps.shas.outputs.pr }}"
curl -sS --fail-with-body --show-error \
--connect-timeout 10 --max-time 7200 \
-X POST "${REVIEW_SERVER}/review" \
-H "Content-Type: application/json" \
-d "{\"base_sha\":\"${BASE_SHA}\",\"head_sha\":\"${HEAD_SHA}\",\"pull_request_number\":${PR_NUMBER}}" \
-o review.json
echo "==== review.json ===="
cat review.json
- name: Post review comments
if: ${{ steps.shas.outputs.skip != 'true' }}
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const pr = context.payload.pull_request.number;
let raw;
try {
raw = fs.readFileSync('review.json', 'utf8');
} catch (e) {
core.warning(`review.json not found: ${e}`);
return;
}
let data;
try {
data = JSON.parse(raw);
} catch (e) {
core.warning(`Failed to parse review.json as JSON: ${e}`);
return;
}
const comments = Array.isArray(data.comments) ? data.comments : [];
for (const c of comments) {
await github.request('POST /repos/{owner}/{repo}/pulls/{pull_number}/comments', {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr,
body: c.body,
commit_id: c.commit_id,
path: c.path,
line: c.line,
side: c.side,
headers: { 'accept': 'application/vnd.github+json' }
});
await new Promise(r => setTimeout(r, 200));
}

716
.github/workflows/es-actions.yml vendored Normal file
View file

@ -0,0 +1,716 @@
name: ES-Actions
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
env:
RUNNER: tools/run-tests.py
jobs:
check-tidy:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Packages
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo add-apt-repository "deb [trusted=yes] http://apt.llvm.org/noble/ llvm-toolchain-noble-20 main"
sudo apt-get update
sudo apt-get install -y clang-format-20
- name: Test
run: tools/check_tidy.py
build-on-macos:
runs-on: macos-15
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Packages
run: |
brew update
brew install ninja icu4c
- name: Build x64
env:
BUILD_OPTIONS: -DESCARGOT_WASM=ON -DESCARGOT_TEMPORAL=ON -DESCARGOT_TCO=ON -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON -DESCARGOT_OUTPUT=shell -GNinja
run: |
# check cpu
sysctl -a | grep machdep.cpu
# add icu path to pkg_config_path
export PKG_CONFIG_PATH="$(brew --prefix icu4c)/lib/pkgconfig"
echo $PKG_CONFIG_PATH
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.10 -H. -Bout/debug/ -DESCARGOT_MODE=debug $BUILD_OPTIONS
ninja -Cout/debug/
$RUNNER --engine="./out/debug/escargot" new-es
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.10 -H. -Bout/release/ -DESCARGOT_MODE=release $BUILD_OPTIONS
ninja -Cout/release/
cp test/octane/*.js .
./out/release/escargot run.js
build-on-macos-arm64:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Packages
run: |
brew update
brew install ninja icu4c
- name: Build arm64
env:
BUILD_OPTIONS: -DESCARGOT_WASM=ON -DESCARGOT_TEMPORAL=ON -DESCARGOT_TCO=ON -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON -DESCARGOT_OUTPUT=shell -GNinja
run: |
# check cpu
sysctl -a | grep machdep.cpu
# add icu path to pkg_config_path
export PKG_CONFIG_PATH="$(brew --prefix icu4c)/lib/pkgconfig"
echo $PKG_CONFIG_PATH
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.10 -H. -Bout/debug/ -DESCARGOT_MODE=debug $BUILD_OPTIONS
ninja -Cout/debug/
$RUNNER --engine="./out/debug/escargot" new-es
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.10 -H. -Bout/release/ -DESCARGOT_MODE=release $BUILD_OPTIONS
ninja -Cout/release/
cp test/octane/*.js .
./out/release/escargot run.js
build-test-on-android:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [x86, x86_64]
api: [28]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Set up JDK
uses: actions/setup-java@v4.1.0
with:
distribution: "zulu"
java-version: 17
- name: Gradle cache
uses: gradle/actions/setup-gradle@v3
- name: Create AVD and run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api }}
arch: ${{ matrix.arch }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -camera-back none -no-snapshot-save -gpu swiftshader_indirect -noaudio -no-boot-anim
disable-animations: true
script: cd build/android/;./gradlew connectedDebugAndroidTest -DESCARGOT_BUILD_TLS_ACCESS_BY_PTHREAD_KEY=ON
build-test-tizen:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: prepare deb sources for GBS
run: echo "deb [trusted=yes] http://download.tizen.org/tools/latest-release/Ubuntu_24.04/ /" | sudo tee /etc/apt/sources.list.d/tizen.list
- name: install GBS
run: sudo apt-get update && sudo apt-get install -y gbs
- name: build
run: |
gbs -c .github/workflows/gbs.conf build -A armv7l -P profile.tizen --incremental --define "enable_shell 1"
test-on-windows-clang-cl:
runs-on: windows-2022
strategy:
matrix:
# clang-cl with cannot generate c++ exception code well
# if clang-cl bug fixed, we can add x64
# clang version and STL version are sometimes not matched in github actions,
# so I add -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH
arch: [
{cpu: "x86", flag: "-m32 -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH"}
#, {cpu: "x64", flag: "-D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH"}
]
steps:
- name: Set git cllf config
run: |
git config --global core.autocrlf input
git config --global core.eol lf
- uses: actions/checkout@v4
with:
submodules: true
- uses: szenius/set-timezone@v2.0
with:
timezoneWindows: "Pacific Standard Time"
- uses: lukka/get-cmake@latest
with:
cmakeVersion: "~3.25.0"
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 26100
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Download and Install Visual C++ Redistributable
shell: powershell
run: |
$vcRedistUrl64 = "https://aka.ms/vs/17/release/vc_redist.x64.exe" # Or the appropriate URL for your target architecture/version
$vcRedistPath64 = "$env:TEMP\vc_redist.x64.exe"
$vcRedistUrl32 = "https://aka.ms/vs/17/release/vc_redist.x86.exe" # Or the appropriate URL for your target architecture/version
$vcRedistPath32 = "$env:TEMP\vc_redist.x86.exe"
Write-Host "Downloading Visual C++ Redistributable from $vcRedistUrl64"
Invoke-WebRequest -Uri $vcRedistUrl64 -OutFile $vcRedistPath64
Write-Host "Downloading Visual C++ Redistributable from $vcRedistUrl32"
Invoke-WebRequest -Uri $vcRedistUrl32 -OutFile $vcRedistPath32
Write-Host "Installing Visual C++ Redistributable silently"
Start-Process -FilePath $vcRedistPath64 -ArgumentList "/install /quiet /norestart" -Wait
Start-Process -FilePath $vcRedistPath32 -ArgumentList "/install /quiet /norestart" -Wait
Write-Host "Visual C++ Redistributable installation complete."
- uses: ilammy/msvc-dev-cmd@v1.13.0
with:
arch: ${{ matrix.arch.cpu }}
sdk: "10.0.26100.0"
- uses: egor-tensin/setup-clang@v1
with:
version: 19.1.7
platform: ${{ matrix.arch.cpu }}
- name: Build ${{ matrix.arch.cpu }} Release
run: |
CMake -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_VERSION:STRING="10.0" -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.arch.cpu }} -Bout/ -DESCARGOT_OUTPUT=shell -DESCARGOT_LIBICU_SUPPORT=ON -DESCARGOT_THREADING=ON -DESCARGOT_TCO=ON -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON -G Ninja -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_BUILD_TYPE=release -DCMAKE_C_FLAGS="${{ matrix.arch.flag }}" -DCMAKE_CXX_FLAGS="${{ matrix.arch.flag }}"
CMake --build out/ --config Release
- name: Run octane
run: |
copy test\octane\*.js
dir
.\out\escargot.exe run.js
# clang-cl with cannot generate c++ exception code well. if clang-cl bug fixed, we can enable test262
# - name: Run test262
# run: |
# set GC_FREE_SPACE_DIVISOR=1
# pip install chardet
# python tools\run-tests.py --engine=%cd%\out\escargot.exe test262 --test262-extra-arg="--skip Temporal --skip intl402 --skip Atomics"
# shell: cmd
- if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15
test-on-windows-x86-x64:
runs-on: windows-2022
strategy:
matrix:
arch: [x86, x64]
steps:
- name: Set git cllf config
run: |
git config --global core.autocrlf input
git config --global core.eol lf
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: szenius/set-timezone@v2.0
with:
timezoneWindows: "Pacific Standard Time"
- uses: lukka/get-cmake@latest
with:
cmakeVersion: "~3.25.0" # <--= optional, use most recent 3.25.x version
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 26100
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Download and Install Visual C++ Redistributable
shell: powershell
run: |
$vcRedistUrl64 = "https://aka.ms/vs/17/release/vc_redist.x64.exe" # Or the appropriate URL for your target architecture/version
$vcRedistPath64 = "$env:TEMP\vc_redist.x64.exe"
$vcRedistUrl32 = "https://aka.ms/vs/17/release/vc_redist.x86.exe" # Or the appropriate URL for your target architecture/version
$vcRedistPath32 = "$env:TEMP\vc_redist.x86.exe"
Write-Host "Downloading Visual C++ Redistributable from $vcRedistUrl64"
Invoke-WebRequest -Uri $vcRedistUrl64 -OutFile $vcRedistPath64
Write-Host "Downloading Visual C++ Redistributable from $vcRedistUrl32"
Invoke-WebRequest -Uri $vcRedistUrl32 -OutFile $vcRedistPath32
Write-Host "Installing Visual C++ Redistributable silently"
Start-Process -FilePath $vcRedistPath64 -ArgumentList "/install /quiet /norestart" -Wait
Start-Process -FilePath $vcRedistPath32 -ArgumentList "/install /quiet /norestart" -Wait
Write-Host "Visual C++ Redistributable installation complete."
- uses: ilammy/msvc-dev-cmd@v1.13.0
with:
arch: ${{ matrix.arch }}
sdk: "10.0.26100.0"
- name: Build ${{ matrix.arch }} Release
run: |
CMake -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_VERSION:STRING="10.0" -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} -DESCARGOT_ARCH=${{ matrix.arch }} -Bout/ -DESCARGOT_OUTPUT=shell -DESCARGOT_LIBICU_SUPPORT=ON -DESCARGOT_WASM=ON -DESCARGOT_THREADING=ON -DESCARGOT_TCO=ON -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON -G Ninja -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_BUILD_TYPE=release
CMake --build out/ --config Release
# windows internal ICU doesn't support Temporal and intl402 well
# github action windows runner only have 2 CPUs. that's why I disable Atomics(timeout occured with some tests)
- name: Run test262
run: |
set GC_FREE_SPACE_DIVISOR=1
pip install chardet
python tools\run-tests.py --engine=%cd%\out\escargot.exe test262 --test262-extra-arg="--skip Temporal --skip intl402 --skip Atomics --skip sm"
shell: cmd
- name: Run octane
run: |
copy test\octane\*.js
dir
.\out\escargot.exe run.js
- if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15
build-on-windows-x64-uwp-x86-shared:
runs-on: windows-2022
steps:
- name: Set git cllf config
run: |
git config --global core.autocrlf input
git config --global core.eol lf
- uses: actions/checkout@v4
with:
submodules: true
- uses: lukka/get-cmake@latest
with:
cmakeVersion: "~3.25.0" # <--= optional, use most recent 3.25.x version
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 26100
- uses: ilammy/msvc-dev-cmd@v1.13.0
with:
arch: x64
sdk: "10.0.26100.0"
uwp: true
- name: Build x64 UWP Release
run: |
CMake -G "Visual Studio 17 2022" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION:STRING="10.0" -DCMAKE_SYSTEM_PROCESSOR=x64 -Bout/win64_release_uwp/ -DESCARGOT_OUTPUT=shell -DESCARGOT_LIBICU_SUPPORT=ON -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON
CMake --build out\win64_release_uwp --config Release
shell: cmd
- uses: ilammy/msvc-dev-cmd@v1.13.0
with:
arch: x86
sdk: "10.0.26100.0"
- name: Build x86 DLL Release
run: |
CMake -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_VERSION:STRING="10.0" -DCMAKE_SYSTEM_PROCESSOR=x86 -Bout/win32_release_shared/ -DESCARGOT_OUTPUT=shared_lib -DESCARGOT_LIBICU_SUPPORT=ON -DESCARGOT_THREADING=ON -DESCARGOT_TCO=ON -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON -G Ninja -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_BUILD_TYPE=release
CMake --build out/win32_release_shared --config Release
shell: cmd
- if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15
build-test-on-x86-release:
runs-on: ubuntu-24.04
strategy:
matrix:
tc: ['new-es octane', 'v8 chakracore spidermonkey', 'jetstream-only-simple-parallel-1', 'jetstream-only-simple-parallel-2 jsc-stress', 'jetstream-only-simple-parallel-3 jetstream-only-cdjs']
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Packages
run: |
sudo apt-get update
sudo apt-get install -y ninja-build gcc-multilib g++-multilib make g++ pkg-config automake libtool git build-essential checkinstall libncurses-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev
- name: Build python2
run: |
mkdir $GITHUB_WORKSPACE/python2-build/
cd $GITHUB_WORKSPACE/python2-build/
wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz
tar xzf Python-2.7.18.tgz
cd Python-2.7.18
./configure --prefix=/usr/local/python2.7
make -j8
sudo make install
sudo update-alternatives --install /usr/bin/python python /usr/local/python2.7/bin/python2.7 1
- name: Build ICU
run: |
git clone --depth 1 --single-branch -b release-78.1 https://github.com/unicode-org/icu.git $GITHUB_WORKSPACE/icu-build/
cd $GITHUB_WORKSPACE/icu-build/icu4c/source
LDFLAGS="-m32 -Wl,-rpath=$GITHUB_WORKSPACE/icu32/lib/" CFLAGS="-m32" CXXFLAGS="-m32" ./runConfigureICU Linux/gcc --prefix="$GITHUB_WORKSPACE/icu32/"
make -j8
make install
ls $GITHUB_WORKSPACE/icu32/lib/
- name: Build x86
env:
BUILD_OPTIONS: -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=x86 -DESCARGOT_THREADING=ON -DESCARGOT_TEMPORAL=ON -DESCARGOT_TCO=ON -DESCARGOT_TLS_ACCESS_BY_ADDRESS=ON -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON -DESCARGOT_OUTPUT=shell -GNinja
run: |
export CXXFLAGS="-I$GITHUB_WORKSPACE/icu32/include"
export LDFLAGS="-L$GITHUB_WORKSPACE/icu32/lib/ -Wl,-rpath=$GITHUB_WORKSPACE/icu32/lib/"
export PKG_CONFIG_PATH=$GITHUB_WORKSPACE/icu32/lib/pkgconfig
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H. -Bout/release/x86 $BUILD_OPTIONS
ninja -Cout/release/x86
- name: Run release-x86 test
env:
GC_FREE_SPACE_DIVISOR: 1
run: LD_LIBRARY_PATH=$GITHUB_WORKSPACE/icu32/lib $RUNNER --arch=x86 --engine="$GITHUB_WORKSPACE/out/release/x86/escargot" ${{ matrix.tc }}
- if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15
build-test-on-x64-release:
runs-on: ubuntu-24.04
strategy:
matrix:
tc: ['octane v8 web-tooling-benchmark', 'chakracore spidermonkey new-es']
build_opt: ['', '-DESCARGOT_THREADING=ON -DESCARGOT_TCO=ON', '-DESCARGOT_SMALL_CONFIG=ON -DESCARGOT_USE_CUSTOM_LOGGING=ON']
exclude:
# exclude octane, v8, web-tooling-benchmark due to low performance incurred by SMALL_CONFIG
- tc: 'octane v8 web-tooling-benchmark'
build_opt: '-DESCARGOT_SMALL_CONFIG=ON -DESCARGOT_USE_CUSTOM_LOGGING=ON'
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Packages
run: |
sudo apt-get update
sudo apt-get install -y ninja-build g++ pkg-config automake libtool git build-essential checkinstall libncurses-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev
- name: Build ICU(64)
run: |
git clone --depth 1 --single-branch -b release-78.1 https://github.com/unicode-org/icu.git $GITHUB_WORKSPACE/icu64-build/
cd $GITHUB_WORKSPACE/icu64-build/icu4c/source
LDFLAGS="-Wl,-rpath=$GITHUB_WORKSPACE/icu64/lib/" ./runConfigureICU Linux/gcc --prefix="$GITHUB_WORKSPACE/icu64/"
make -j8
make install
- name: Build python2
run: |
mkdir $GITHUB_WORKSPACE/python2-build/
cd $GITHUB_WORKSPACE/python2-build/
wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz
tar xzf Python-2.7.18.tgz
cd Python-2.7.18
./configure --prefix=/usr/local/python2.7
make -j8
sudo make install
sudo update-alternatives --install /usr/bin/python python /usr/local/python2.7/bin/python2.7 1
- name: Build x64
env:
BUILD_OPTIONS: -DESCARGOT_TEMPORAL=ON -DESCARGOT_TCO=ON -DESCARGOT_TLS_ACCESS_BY_ADDRESS=ON -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON -DESCARGOT_OUTPUT=shell -GNinja
run: |
export CXXFLAGS="-I$GITHUB_WORKSPACE/icu64/include"
export LDFLAGS="-L$GITHUB_WORKSPACE/icu64/lib -Wl,-rpath=$GITHUB_WORKSPACE/icu64/lib"
export PKG_CONFIG_PATH=$GITHUB_WORKSPACE/icu64/lib/pkgconfig
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H. -Bout/release/x64 $BUILD_OPTIONS ${{ matrix.build_opt }}
ninja -Cout/release/x64
- name: Run release-x64 test
env:
GC_FREE_SPACE_DIVISOR: 1
run: |
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/icu64/lib
# set locale
sudo locale-gen en_US.UTF-8
export LANG=en_US.UTF-8
locale
$RUNNER --arch=x86_64 --engine="$GITHUB_WORKSPACE/out/release/x64/escargot" ${{ matrix.tc }}
- if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15
build-test-on-x86-x64-debug:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Packages
run: |
sudo apt-get update
sudo apt-get install -y ninja-build gcc-multilib g++-multilib make g++ pkg-config automake libtool git build-essential checkinstall libncurses-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev
- name: Build ICU(32)
run: |
git clone --depth 1 --single-branch -b release-78.1 https://github.com/unicode-org/icu.git $GITHUB_WORKSPACE/icu32-build/
cd $GITHUB_WORKSPACE/icu32-build/icu4c/source
LDFLAGS="-m32 -Wl,-rpath=$GITHUB_WORKSPACE/icu32/lib/" CFLAGS="-m32" CXXFLAGS="-m32" ./runConfigureICU Linux/gcc --prefix="$GITHUB_WORKSPACE/icu32/"
make -j8
make install
- name: Build ICU(64)
run: |
git clone --depth 1 --single-branch -b release-78.1 https://github.com/unicode-org/icu.git $GITHUB_WORKSPACE/icu64-build/
cd $GITHUB_WORKSPACE/icu64-build/icu4c/source
LDFLAGS="-Wl,-rpath=$GITHUB_WORKSPACE/icu64/lib/" ./runConfigureICU Linux/gcc --prefix="$GITHUB_WORKSPACE/icu64/"
make -j8
make install
- name: Build x86/x64
env:
BUILD_OPTIONS_X86: -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=x86 -DESCARGOT_MODE=debug -DESCARGOT_TEMPORAL=ON -DESCARGOT_TCO=ON -DESCARGOT_TLS_ACCESS_BY_ADDRESS=ON -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON -DESCARGOT_OUTPUT=shell -GNinja
BUILD_OPTIONS_X64: -DESCARGOT_MODE=debug -DESCARGOT_TEMPORAL=ON -DESCARGOT_TCO=ON -DESCARGOT_TLS_ACCESS_BY_ADDRESS=ON -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON -DESCARGOT_OUTPUT=shell -GNinja
run: |
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H. -Bout/debug/x86 $BUILD_OPTIONS_X86
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H. -Bout/debug/x64 $BUILD_OPTIONS_X64
ninja -Cout/debug/x86
ninja -Cout/debug/x64
- name: Run debug-mode test
run: |
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/icu32/lib
$RUNNER --arch=x86 --engine="$GITHUB_WORKSPACE/out/debug/x86/escargot" modifiedVendorTest regression-tests new-es intl sunspider-js
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/icu64/lib
$RUNNER --arch=x86_64 --engine="$GITHUB_WORKSPACE/out/debug/x64/escargot" modifiedVendorTest regression-tests new-es intl sunspider-js
build-test-on-self-hosted-linux:
if: github.repository == 'Samsung/escargot'
runs-on: [self-hosted, linux, x64, test]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Build
env:
BUILD_OPTIONS: -DESCARGOT_THREADING=ON -DESCARGOT_TEMPORAL=ON -DESCARGOT_TCO=ON -DESCARGOT_TLS_ACCESS_BY_ADDRESS=ON -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON -DESCARGOT_OUTPUT=shell -GNinja
run: |
LDFLAGS=" -L/usr/icu78-32/lib/ -Wl,-rpath=/usr/icu78-32/lib/" PKG_CONFIG_PATH="/usr/icu78-32/lib/pkgconfig/" cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H./ -Bbuild/out_linux -DESCARGOT_ARCH=x86 -DESCARGOT_MODE=debug -DESCARGOT_TCO_DEBUG=ON $BUILD_OPTIONS
LDFLAGS=" -L/usr/icu78-32/lib/ -Wl,-rpath=/usr/icu78-32/lib/" PKG_CONFIG_PATH="/usr/icu78-32/lib/pkgconfig/" cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H./ -Bbuild/out_linux_release -DESCARGOT_ARCH=x86 $BUILD_OPTIONS
LDFLAGS=" -L/usr/icu78-32/lib/ -Wl,-rpath=/usr/icu78-32/lib/" PKG_CONFIG_PATH="/usr/icu78-32/lib/pkgconfig/" cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H./ -Bbuild/out_linux_release_clang -DESCARGOT_ARCH=x86 $BUILD_OPTIONS
gcc -shared -m32 -fPIC -o backtrace-hooking-32.so tools/test/test262/backtrace-hooking.c
LDFLAGS=" -L/usr/icu78-64/lib/ -Wl,-rpath=/usr/icu78-64/lib/" PKG_CONFIG_PATH="/usr/icu78-64/lib/pkgconfig/" cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H./ -Bbuild/out_linux64 -DESCARGOT_ARCH=x64 -DESCARGOT_MODE=debug -DESCARGOT_TCO_DEBUG=ON $BUILD_OPTIONS
LDFLAGS=" -L/usr/icu78-64/lib/ -Wl,-rpath=/usr/icu78-64/lib/" PKG_CONFIG_PATH="/usr/icu78-64/lib/pkgconfig/" cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H./ -Bbuild/out_linux64_release -DESCARGOT_ARCH=x64 -DESCARGOT_MODE=release $BUILD_OPTIONS
LDFLAGS=" -L/usr/icu78-64/lib/ -Wl,-rpath=/usr/icu78-64/lib/" PKG_CONFIG_PATH="/usr/icu78-64/lib/pkgconfig/" cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H./ -Bbuild/out_linux64_release_clang -DESCARGOT_ARCH=x64 -DESCARGOT_MODE=release $BUILD_OPTIONS
cmake --build build/out_linux/
cmake --build build/out_linux64/
cmake --build build/out_linux_release/
cmake --build build/out_linux_release_clang/
cmake --build build/out_linux64_release/
cmake --build build/out_linux64_release_clang/
- name: Test
run: |
LD_LIBRARY_PATH=/usr/icu78-32/lib/ GC_FREE_SPACE_DIVISOR=1 $RUNNER --arch=x86 --engine="${{ github.workspace }}/build/out_linux_release/escargot" test262
LD_LIBRARY_PATH=/usr/icu78-32/lib/ GC_FREE_SPACE_DIVISOR=1 $RUNNER --arch=x86 --engine="${{ github.workspace }}/build/out_linux_release_clang/escargot" test262
LD_LIBRARY_PATH=/usr/icu78-32/lib/ GC_FREE_SPACE_DIVISOR=1 ESCARGOT_LD_PRELOAD=${{ github.workspace }}/backtrace-hooking-32.so $RUNNER --arch=x86 --engine="${{ github.workspace }}/build/out_linux/escargot" test262
LD_LIBRARY_PATH=/usr/icu78-64/lib/ GC_FREE_SPACE_DIVISOR=1 $RUNNER --arch=x86_64 --engine="${{ github.workspace }}/build/out_linux64_release/escargot" test262
LD_LIBRARY_PATH=/usr/icu78-64/lib/ GC_FREE_SPACE_DIVISOR=1 $RUNNER --arch=x86_64 --engine="${{ github.workspace }}/build/out_linux64_release_clang/escargot" test262
LD_LIBRARY_PATH=/usr/icu78-64/lib/ python tools/kangax/run-kangax.py --engine="${{ github.workspace }}/build/out_linux64/escargot"
build-test-on-self-hosted-arm-linux:
if: github.repository == 'Samsung/escargot'
runs-on: [self-hosted, linux, arm, test]
strategy:
matrix:
compiler: [ {cxx: g++, cc: gcc}, {cxx: clang++, cc: clang} ]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Build
run: |
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H./ -Bout -DCMAKE_C_COMPILER=${{ matrix.compiler.cc }} -DCMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=arm32 -DESCARGOT_MODE=release -DESCARGOT_THREADING=ON -DESCARGOT_TEMPORAL=OFF -DESCARGOT_TCO=ON -DESCARGOT_TLS_ACCESS_BY_ADDRESS=${{ matrix.compiler.tls }} -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON -DESCARGOT_OUTPUT=shell -GNinja
cmake --build ./out/
- name: Test
run: |
GC_FREE_SPACE_DIVISOR=1 $RUNNER --engine="${{ github.workspace }}/out/escargot" --test262-extra-arg="--skip intl402 --skip sm --skip Temporal" new-es v8 spidermonkey chakracore test262
build-test-on-self-hosted-arm64-linux:
if: github.repository == 'Samsung/escargot'
runs-on: [self-hosted, linux, arm64, test]
strategy:
matrix:
compiler: [ {cxx: g++-11, cc: gcc-11}, {cxx: clang++, cc: clang} ]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Build
run: |
LDFLAGS=" -L/usr/icu78-64/lib/ -Wl,-rpath=/usr/icu78-64/lib/" PKG_CONFIG_PATH="/usr/icu78-64/lib/pkgconfig/" cmake -DCMAKE_C_COMPILER=${{ matrix.compiler.cc }} -DCMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H./ -Bout -DESCARGOT_MODE=release -DESCARGOT_THREADING=ON -DESCARGOT_TEMPORAL=ON -DESCARGOT_TCO=ON -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON -DESCARGOT_OUTPUT=shell -GNinja
cmake --build ./out/
- name: Test
run: |
export LD_LIBRARY_PATH=/usr/icu78-64/lib/
GC_FREE_SPACE_DIVISOR=1 $RUNNER --engine="${{ github.workspace }}/out/escargot" --test262-extra-arg="--skip intl402 --skip sm" test262 chakracore spidermonkey v8 new-es
build-test-on-riscv64-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Build in riscv64 container
uses: uraimo/run-on-arch-action@v3
with:
arch: riscv64
distro: ubuntu22.04
# Install deps into the container. With the token, the container will be cached
# The image is cached publically like a package
githubToken: ${{ github.token }}
install: |
apt-get update
apt-get install -y cmake build-essential ninja-build pkg-config python3 git libicu-dev
run: |
cmake -H. -Bout/riscv64 -DESCARGOT_TEMPORAL=ON -DESCARGOT_TCO=ON -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON -DESCARGOT_OUTPUT=shell -GNinja
ninja -Cout/riscv64
python3 ./tools/run-tests.py --engine="./out/riscv64/escargot" new-es intl sunspider-js
build-test-debugger:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Packages
run: |
sudo apt-get update
sudo apt-get install -y ninja-build
- name: Build
env:
BUILD_OPTIONS: -DESCARGOT_MODE=debug -DESCARGOT_DEBUGGER=1 -DESCARGOT_TEMPORAL=ON -DESCARGOT_TCO=ON -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON -DESCARGOT_OUTPUT=shell -GNinja
run: |
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H. -Bout/debugger $BUILD_OPTIONS
ninja -Cout/debugger
- name: Debugger Test
run: |
$RUNNER --arch=x86_64 --engine="$GITHUB_WORKSPACE/out/debugger/escargot" debugger-server-source
$RUNNER --arch=x86_64 --engine="$GITHUB_WORKSPACE/out/debugger/escargot" debugger-client-source
build-test-api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Packages
run: |
sudo apt-get update
sudo apt-get install -y ninja-build gcc-multilib g++-multilib
- name: Build x86/x64
env:
BUILD_OPTIONS_X86: -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=x86 -DESCARGOT_MODE=debug -DESCARGOT_THREADING=ON -DESCARGOT_DEBUGGER=1 -DESCARGOT_USE_EXTENDED_API=ON -DESCARGOT_TEST=ON -DESCARGOT_OUTPUT=cctest -GNinja
BUILD_OPTIONS_X64: -DESCARGOT_MODE=debug -DESCARGOT_THREADING=1 -DESCARGOT_DEBUGGER=1 -DESCARGOT_USE_EXTENDED_API=ON -DESCARGOT_TEST=ON -DESCARGOT_OUTPUT=cctest -GNinja
run: |
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H. -Bout/cctest/x86 $BUILD_OPTIONS_X86
ninja -Cout/cctest/x86
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H. -Bout/cctest/x64 $BUILD_OPTIONS_X64
ninja -Cout/cctest/x64
- name: Run Test
run: |
$RUNNER --arch=x86 --engine="$GITHUB_WORKSPACE/out/cctest/x86/cctest" cctest
$RUNNER --arch=x86_64 --engine="$GITHUB_WORKSPACE/out/cctest/x64/cctest" cctest
build-test-codecache:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Packages
run: |
# for i386 ICU
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y ninja-build gcc-multilib g++-multilib
sudo apt-get install -y libicu-dev:i386 # install i386 ICU
- name: Build x86
env:
BUILD_OPTIONS: -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=x86 -DESCARGOT_MODE=debug -DESCARGOT_CODE_CACHE=ON -DESCARGOT_TEMPORAL=ON -DESCARGOT_TCO=ON -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON -DESCARGOT_OUTPUT=shell -GNinja
run: |
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H. -Bout/codecache/x86 $BUILD_OPTIONS
ninja -Cout/codecache/x86
- name: Build x64
env:
BUILD_OPTIONS: -DESCARGOT_MODE=debug -DESCARGOT_CODE_CACHE=ON -DESCARGOT_TEMPORAL=ON -DESCARGOT_TCO=ON -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON -DESCARGOT_OUTPUT=shell -GNinja
run: |
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H. -Bout/codecache/x64 $BUILD_OPTIONS
ninja -Cout/codecache/x64
- name: Build x64 Release Mode
env:
BUILD_OPTIONS: -DESCARGOT_MODE=release -DESCARGOT_CODE_CACHE=ON -DESCARGOT_TEMPORAL=ON -DESCARGOT_TCO=ON -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON -DESCARGOT_OUTPUT=shell -GNinja
run: |
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H. -Bout/codecache/release/x64 $BUILD_OPTIONS
ninja -Cout/codecache/release/x64
- name: Run x86 test
run: |
$RUNNER --arch=x86 --engine="$GITHUB_WORKSPACE/out/codecache/x86/escargot" sunspider-js
$RUNNER --arch=x86 --engine="$GITHUB_WORKSPACE/out/codecache/x86/escargot" sunspider-js
$RUNNER --arch=x86 --engine="$GITHUB_WORKSPACE/out/codecache/x86/escargot" new-es
$RUNNER --arch=x86 --engine="$GITHUB_WORKSPACE/out/codecache/x86/escargot" new-es
$RUNNER --arch=x86 --engine="$GITHUB_WORKSPACE/out/codecache/x86/escargot" octane-loading
$RUNNER --arch=x86 --engine="$GITHUB_WORKSPACE/out/codecache/x86/escargot" octane-loading
rm -rf $HOME/Escargot-cache/
- name: Run x64 test
run: |
$RUNNER --arch=x86_64 --engine="$GITHUB_WORKSPACE/out/codecache/x64/escargot" sunspider-js
$RUNNER --arch=x86_64 --engine="$GITHUB_WORKSPACE/out/codecache/x64/escargot" sunspider-js
$RUNNER --arch=x86_64 --engine="$GITHUB_WORKSPACE/out/codecache/x64/escargot" new-es
$RUNNER --arch=x86_64 --engine="$GITHUB_WORKSPACE/out/codecache/x64/escargot" new-es
$RUNNER --arch=x86_64 --engine="$GITHUB_WORKSPACE/out/codecache/x64/escargot" octane-loading
$RUNNER --arch=x86_64 --engine="$GITHUB_WORKSPACE/out/codecache/x64/escargot" octane-loading
rm -rf $HOME/Escargot-cache/
- name: Run x64 release test
run: |
$RUNNER --arch=x86_64 --engine="$GITHUB_WORKSPACE/out/codecache/release/x64/escargot" web-tooling-benchmark
rm -rf $HOME/Escargot-cache/
- name: Handle error cases
run: |
$RUNNER --arch=x86_64 --engine="$GITHUB_WORKSPACE/out/codecache/x64/escargot" sunspider-js
rm $HOME/Escargot-cache/2728638815_17149
$RUNNER --arch=x86_64 --engine="$GITHUB_WORKSPACE/out/codecache/x64/escargot" sunspider-js
ls -1q $HOME/Escargot-cache/ | wc -l
$RUNNER --arch=x86_64 --engine="$GITHUB_WORKSPACE/out/codecache/x64/escargot" sunspider-js
rm $HOME/Escargot-cache/cache_list
$RUNNER --arch=x86_64 --engine="$GITHUB_WORKSPACE/out/codecache/x64/escargot" sunspider-js
- if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15
build-test-wasmjs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Packages
run: |
sudo apt-get update
sudo apt-get install -y ninja-build gcc-multilib g++-multilib make g++ pkg-config automake libtool git build-essential checkinstall libncurses-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev
- name: Build ICU(32)
run: |
git clone --depth 1 --single-branch -b release-78.1 https://github.com/unicode-org/icu.git $GITHUB_WORKSPACE/icu-build/
cd $GITHUB_WORKSPACE/icu-build/icu4c/source
LDFLAGS="-m32 -Wl,-rpath=$GITHUB_WORKSPACE/icu32/lib/" CFLAGS="-m32" CXXFLAGS="-m32" ./runConfigureICU Linux/gcc --prefix="$GITHUB_WORKSPACE/icu32/"
make -j8
make install
- name: Build ICU(64)
run: |
git clone --depth 1 --single-branch -b release-78.1 https://github.com/unicode-org/icu.git $GITHUB_WORKSPACE/icu64-build/
cd $GITHUB_WORKSPACE/icu64-build/icu4c/source
LDFLAGS="-Wl,-rpath=$GITHUB_WORKSPACE/icu64/lib/" ./runConfigureICU Linux/gcc --prefix="$GITHUB_WORKSPACE/icu64/"
make -j8
make install
- name: Build x86
env:
BUILD_OPTIONS: -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=x86 -DESCARGOT_MODE=debug -DESCARGOT_WASM=ON -DESCARGOT_TEMPORAL=ON -DESCARGOT_TCO=ON -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON -DESCARGOT_OUTPUT=shell -GNinja
run: |
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H. -Bout/wasm/x86 $BUILD_OPTIONS
ninja -Cout/wasm/x86
- name: Build x64
env:
BUILD_OPTIONS: -DESCARGOT_MODE=debug -DESCARGOT_WASM=ON -DESCARGOT_TEMPORAL=ON -DESCARGOT_TCO=ON -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON -DESCARGOT_OUTPUT=shell -GNinja
run: |
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H. -Bout/wasm/x64 $BUILD_OPTIONS
ninja -Cout/wasm/x64
- name: Run x86 test
run: |
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/icu32/lib
$RUNNER --arch=x86 --engine="$GITHUB_WORKSPACE/out/wasm/x86/escargot" wasm-js
- name: Run x64 test
run: |
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/icu64/lib
$RUNNER --arch=x86_64 --engine="$GITHUB_WORKSPACE/out/wasm/x64/escargot" wasm-js
- if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 60

11
.github/workflows/gbs.conf vendored Normal file
View file

@ -0,0 +1,11 @@
[general]
profile = profile.tizen
[profile.tizen]
repos = repo.tizen_base_reference,repo.tizen_reference
[repo.tizen_reference]
url = https://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Unified/reference/repos/standard/packages/
[repo.tizen_base_reference]
url = https://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Base/reference/repos/standard/packages/

322
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,322 @@
name: Release
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
env:
RUNNER: tools/run-tests.py
BUILD_OPTIONS: -DESCARGOT_MODE=release -DESCARGOT_LIBICU_SUPPORT_WITH_DLOPEN=OFF -DESCARGOT_DEPLOY=ON -DESCARGOT_THREADING=ON -DESCARGOT_TCO=ON -DESCARGOT_TEST=ON -DESCARGOT_OUTPUT=shell -GNinja
jobs:
build-macOS:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-15, macos-latest]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Packages
run: |
brew update
brew install ninja icu4c zip
- name: Build x64
run: |
# check cpu
sysctl -a | grep machdep.cpu
# add icu path to pkg_config_path
export PKG_CONFIG_PATH="$(brew --prefix icu4c)/lib/pkgconfig"
echo $PKG_CONFIG_PATH
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.10 -H. -Bout/ $BUILD_OPTIONS
ninja -Cout/
- name: Check
run: |
file out/escargot
strip out/escargot
# set deploy directory
mkdir -p deploy
# set escargot
cp out/escargot ./deploy/.
LIBS=$(otool -L ./deploy/escargot | grep "icu" | awk '{print $1}')
for LIB in $LIBS; do
BASENAME=$(basename "$LIB")
install_name_tool -change "$LIB" "@executable_path/$BASENAME" deploy/escargot
done
# set icu libs
ICU_LIBS=("libicuuc" "libicui18n" "libicudata")
ICU_SOURCE_PATH="$(brew --prefix icu4c)/lib"
ICU_VERSION=$(find "$ICU_SOURCE_PATH" -name "libicuuc.*.dylib" | grep -oE '\.[0-9]+\.' | head -n 1 | tr -d '.')
if [ -z "$ICU_VERSION" ]; then
echo "ICU version could not be detected."
exit 1
else
echo "Detected ICU Version: $ICU_VERSION"
fi
for LIB in "${ICU_LIBS[@]}"; do
cp -a $ICU_SOURCE_PATH/$LIB.*.dylib ./deploy/.
install_name_tool -id "@loader_path/$LIB.$ICU_VERSION.dylib" "./deploy/$LIB.$ICU_VERSION.dylib"
done
# check results
echo "Check results..."
ls ./deploy
otool -L ./deploy/escargot
otool -L ./deploy/libicu*.dylib
# Ad-hoc sign
set -e
cd deploy
for f in libicu*.dylib; do [ -e "$f" ] || continue; codesign -f -s - "$f"; done
codesign --force --deep -s - ./escargot
for f in ./escargot libicu*.dylib; do [ -e "$f" ] || continue; codesign --verify --strict --verbose=6 "$f"; done
cd ..
# run test
$RUNNER --engine="$GITHUB_WORKSPACE/deploy/escargot" new-es
# zip results
if [ "${{ matrix.os }}" == "macos-15" ]; then
zip -j escargot-mac64.zip deploy/*
elif [ "${{ matrix.os }}" == "macos-latest" ]; then
zip -j escargot-mac64arm.zip deploy/*
fi
- name: Upload mac64
if: ${{ matrix.os == 'macos-15' }}
uses: actions/upload-artifact@v4
with:
name: build-artifact-mac64
path: ./escargot-mac64.zip
- name: Upload mac64arm
if: ${{ matrix.os == 'macos-latest' }}
uses: actions/upload-artifact@v4
with:
name: build-artifact-mac64arm
path: ./escargot-mac64arm.zip
build-linux:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Packages
run: |
# for i386 ICU
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y ninja-build libicu-dev gcc-multilib g++-multilib zip patchelf
sudo apt-get install -y libicu-dev:i386 # install i386 ICU
- name: Build x86/x64
run: |
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H. -Bout/x86 -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=x86 -DESCARGOT_TEMPORAL=ON $BUILD_OPTIONS
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H. -Bout/x64 -DESCARGOT_TEMPORAL=ON $BUILD_OPTIONS
ninja -Cout/x86
ninja -Cout/x64
- name: Check
run: |
file out/x86/escargot
file out/x64/escargot
strip out/x86/escargot
strip out/x64/escargot
# set locale
sudo locale-gen en_US.UTF-8
export LANG=en_US.UTF-8
locale
# set deploy directory and copy escargot binary
mkdir -p deploy-x86
mkdir -p deploy-x64
cp out/x86/escargot ./deploy-x86/.
cp out/x64/escargot ./deploy-x64/.
# set icu libs
ldd deploy-x86/escargot | grep "icu" | grep "=>" | awk '{print $3}' | xargs -I '{}' cp '{}' deploy-x86/
ldd deploy-x64/escargot | grep "icu" | grep "=>" | awk '{print $3}' | xargs -I '{}' cp '{}' deploy-x64/
for LIB in ./deploy-x86/libicu*; do
patchelf --set-rpath '$ORIGIN' "$LIB"
done
for LIB in ./deploy-x64/libicu*; do
patchelf --set-rpath '$ORIGIN' "$LIB"
done
# check results
echo "Check results..."
ls ./deploy-x86
ldd deploy-x86/escargot
ldd deploy-x86/libicu*
ls ./deploy-x64
ldd deploy-x64/escargot
ldd deploy-x64/libicu*
# run test
$RUNNER --engine="$GITHUB_WORKSPACE/deploy-x86/escargot" new-es
$RUNNER --engine="$GITHUB_WORKSPACE/deploy-x64/escargot" new-es
# zip results
zip -j escargot-linux-x86.zip deploy-x86/*
zip -j escargot-linux-x64.zip deploy-x64/*
- name: Upload
uses: actions/upload-artifact@v4
with:
name: build-artifact-linux
path: escargot-linux-*.zip
build-windows:
runs-on: windows-2022
strategy:
matrix:
arch: [x86, x64]
steps:
- name: Set git cllf config
run: |
git config --global core.autocrlf input
git config --global core.eol lf
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: szenius/set-timezone@v2.0
with:
timezoneWindows: "Pacific Standard Time"
- uses: lukka/get-cmake@latest
with:
cmakeVersion: "~3.25.0"
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 26100
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Download and Install Visual C++ Redistributable
shell: powershell
run: |
$vcRedistUrl64 = "https://aka.ms/vs/17/release/vc_redist.x64.exe" # Or the appropriate URL for your target architecture/version
$vcRedistPath64 = "$env:TEMP\vc_redist.x64.exe"
$vcRedistUrl32 = "https://aka.ms/vs/17/release/vc_redist.x86.exe" # Or the appropriate URL for your target architecture/version
$vcRedistPath32 = "$env:TEMP\vc_redist.x86.exe"
Write-Host "Downloading Visual C++ Redistributable from $vcRedistUrl64"
Invoke-WebRequest -Uri $vcRedistUrl64 -OutFile $vcRedistPath64
Write-Host "Downloading Visual C++ Redistributable from $vcRedistUrl32"
Invoke-WebRequest -Uri $vcRedistUrl32 -OutFile $vcRedistPath32
Write-Host "Installing Visual C++ Redistributable silently"
Start-Process -FilePath $vcRedistPath64 -ArgumentList "/install /quiet /norestart" -Wait
Start-Process -FilePath $vcRedistPath32 -ArgumentList "/install /quiet /norestart" -Wait
Write-Host "Visual C++ Redistributable installation complete."
- uses: ilammy/msvc-dev-cmd@v1.13.0
with:
arch: ${{ matrix.arch }}
sdk: "10.0.26100.0"
- name: Install zip if not available
run: |
if (-Not (Get-Command zip -ErrorAction SilentlyContinue)) {
choco install zip -y
}
- name: Build ${{ matrix.arch }}
run: |
CMake -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_VERSION:STRING="10.0" -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} -DESCARGOT_ARCH=${{ matrix.arch }} -Bout/ -DESCARGOT_OUTPUT=shell -DESCARGOT_LIBICU_SUPPORT=ON -DESCARGOT_WASM=ON -DESCARGOT_THREADING=ON -DESCARGOT_TCO=ON -DESCARGOT_TEST=ON -DESCARGOT_SHADOWREALM=ON -G Ninja -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_BUILD_TYPE=release
CMake --build out/ --config Release
- name: Check
run: |
python tools\run-tests.py --engine=%cd%\out\escargot.exe new-es
rename out\escargot.exe escargot-win-${{ matrix.arch }}.exe
zip -j escargot-win-${{ matrix.arch}}.zip out\escargot-win-${{ matrix.arch }}.exe
shell: cmd
- name: Upload
uses: actions/upload-artifact@v4
with:
name: build-artifact-win-${{ matrix.arch }}
path: escargot-win-${{ matrix.arch }}.zip
check-build-mac64:
needs: [build-macOS]
runs-on: macos-15
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: build-artifact-mac64
merge-multiple: true
- name: Check
run: |
unzip artifacts/escargot-mac64.zip -d artifacts
otool -L artifacts/escargot
otool -L artifacts/*.dylib
$RUNNER --engine="$GITHUB_WORKSPACE/artifacts/escargot" new-es
check-build-mac64arm:
needs: [build-macOS]
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: build-artifact-mac64arm
merge-multiple: true
- name: Check
run: |
unzip artifacts/escargot-mac64arm.zip -d artifacts
otool -L artifacts/escargot
otool -L artifacts/*.dylib
$RUNNER --engine="$GITHUB_WORKSPACE/artifacts/escargot" new-es
check-build-linux:
needs: [build-linux]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: build-artifact-linux
merge-multiple: true
- name: Check
run: |
dpkg -l | grep libicu-dev
mkdir -p result-x86
mkdir -p result-x64
unzip artifacts/escargot-linux-x86.zip -d result-x86
unzip artifacts/escargot-linux-x64.zip -d result-x64
ldd result-x86/escargot
ldd result-x86/libicu*
ldd result-x64/escargot
ldd result-x64/libicu*
$RUNNER --engine="$GITHUB_WORKSPACE/result-x86/escargot" new-es
$RUNNER --engine="$GITHUB_WORKSPACE/result-x64/escargot" new-es
update-release:
needs: [check-build-mac64, check-build-mac64arm, check-build-linux, build-windows]
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: build-artifact-*
merge-multiple: true
- name: Upload to release
uses: softprops/action-gh-release@v2
with:
files: |
artifacts/escargot-*

15
.gitignore vendored
View file

@ -1,5 +1,5 @@
#error_report
escargot
/escargot
escargot.x*
.project
.cproject
@ -10,7 +10,6 @@ output.js
*.d
*.js
*.swp
#!test/*.js
*.pyc
tags
cscope.out
@ -19,13 +18,15 @@ cscope.out
#memps
escargot.asm
escargot.elf
out
out/*
build.ninja
rules.ninja
#test/test262/test/config/excludelist.xml
.ninja_deps
.ninja_log
android/obj
android/libs
tools/vendortest/chakracore/chakracorelog.verbose.txt
tools/test/jetstream/*.res
*.gen.txt
*.log.txt
*.sort.txt
@ -34,3 +35,9 @@ node_modules
CMakeCache.txt
CMakeFiles
cmake_install.cmake
#etc
.vscode
EscargotInfo.h
escargot.pc
escargot_generated/*
.vs/*

View file

@ -1,421 +0,0 @@
image: 10.113.64.54:5000/escargot/escargot:latest
build_x64_release:
stage: build
tags:
- escargot_main_build
before_script:
- unset TIZEN_SDK_HOME
- rm -f .git/index.lock
- rm -f .git/modules/third_party/GCutil/index.lock
- git submodule deinit -f third_party/GCutil
- git submodule init
- git submodule update third_party/GCutil
- ARCH=x64 MODE=release ./build_third_party.sh
- make clean
script:
- VENDORTEST=1 make x64.interpreter.release -j$(nproc)
artifacts:
paths:
- out/linux/x64/interpreter/release/escargot
test_x64_release_sunspider:
stage: test
before_script:
- rm -f .git/index.lock
- rm -f .git/modules/test/vendortest/index.lock
- git submodule deinit -f test/vendortest
- git submodule init
- git submodule update test/vendortest
- cp out/linux/x64/interpreter/release/escargot ./escargot
script: ./escargot test/vendortest/SunSpider/tests/sunspider-1.0.2/*.js; exit $?;
dependencies:
- build_x64_release
test_x64_release_octane:
stage: test
before_script:
- rm -f .git/index.lock
- rm -f .git/modules/test/octane/index.lock
- git submodule deinit -f test/octane
- git submodule init
- git submodule update test/octane
- cp out/linux/x64/interpreter/release/escargot ./escargot
script: make run-octane | tail -1 > out/octane_result; if ! cat out/octane_result | grep -c 'Score' > /dev/null; then exit 1; fi
dependencies:
- build_x64_release
test_x64_release_test262:
stage: test
before_script:
- rm -f .git/index.lock
- rm -f .git/modules/test/test262/index.lock
- git submodule deinit -f test/test262
- git submodule init
- git submodule update test/test262
- cp out/linux/x64/interpreter/release/escargot ./escargot
script: make run-test262; exit $?;
dependencies:
- build_x64_release
test_x64_release_jetstream_only_cdjs:
stage: test
before_script:
- rm -f .git/index.lock
- rm -f .git/modules/test/vendortest/index.lock
- git submodule deinit -f test/vendortest
- git submodule init
- git submodule update test/vendortest
- cp out/linux/x64/interpreter/release/escargot ./escargot
script: make run-jetstream-only-cdjs; if cat test/vendortest/driver/jetstream/jetstream-result-raw.res | grep -c 'NaN' > /dev/null; then exit 1; fi; exit $?;
dependencies:
- build_x64_release
test_x64_release_jetstream_only_simple:
stage: test
tags:
- escargot_allow_slow
before_script:
- rm -f .git/index.lock
- rm -f .git/modules/test/vendortest/index.lock
- git submodule deinit -f test/vendortest
- git submodule init
- git submodule update test/vendortest
- cp out/linux/x64/interpreter/release/escargot ./escargot
script: make run-jetstream-only-simple; if cat test/vendortest/driver/jetstream/jetstream-result-raw.res | grep -c 'NaN' > /dev/null; then exit 1; fi; exit $?;
dependencies:
- build_x64_release
test_x64_release_spidermonkey:
stage: test
before_script:
- rm -f .git/index.lock
- rm -f .git/modules/test/vendortest/index.lock
- git submodule deinit -f test/vendortest
- git submodule init
- git submodule update test/vendortest
- cp out/linux/x64/interpreter/release/escargot ./escargot
script: make run-spidermonkey-full; exit $?;
dependencies:
- build_x64_release
test_x64_release_internal:
stage: test
tags:
before_script:
- rm -f .git/index.lock
- rm -f .git/modules/test/vendortest/index.lock
- git submodule deinit -f test/vendortest
- git submodule init
- git submodule update test/vendortest
- cp out/linux/x64/interpreter/release/escargot ./escargot
script: make run-internal-test; exit $?;
dependencies:
- build_x64_release
test_x64_release_v8:
stage: test
tags:
before_script:
- rm -f .git/index.lock
- rm -f .git/modules/test/vendortest/index.lock
- git submodule deinit -f test/vendortest
- git submodule init
- git submodule update test/vendortest
- cp out/linux/x64/interpreter/release/escargot ./escargot
script: make run-v8; exit $?;
dependencies:
- build_x64_release
test_x64_release_chakracore:
stage: test
tags:
- escargot_allow_slow
before_script:
- git submodule deinit -f test/vendortest
- git submodule init
- git submodule update test/vendortest
- cp out/linux/x64/interpreter/release/escargot ./escargot
script: make run-chakracore; exit $?;
dependencies:
- build_x64_release
test_x64_release_jsc:
stage: test
tags:
- escargot_allow_slow
before_script:
- git submodule deinit -f test/vendortest
- git submodule init
- git submodule update test/vendortest
- cp out/linux/x64/interpreter/release/escargot ./escargot
script: make run-jsc-stress; exit $?;
dependencies:
- build_x64_release
###############################################################################
build_x86_release:
stage: build
tags:
- escargot_main_build
before_script:
- unset TIZEN_SDK_HOME
- rm -f .git/index.lock
- rm -f .git/modules/third_party/GCutil/index.lock
- git submodule deinit -f third_party/GCutil
- git submodule init
- git submodule update third_party/GCutil
- ARCH=x86 MODE=release ./build_third_party.sh
- make clean
script:
- VENDORTEST=1 make x86.interpreter.release -j$(nproc)
artifacts:
paths:
- out/linux/x86/interpreter/release/escargot
test_x86_release_sunspider:
stage: test
before_script:
- rm -f .git/index.lock
- rm -f .git/modules/test/vendortest/index.lock
- git submodule deinit -f test/vendortest
- git submodule init
- git submodule update test/vendortest
- cp out/linux/x86/interpreter/release/escargot ./escargot
script: ./escargot test/vendortest/SunSpider/tests/sunspider-1.0.2/*.js; exit $?;
dependencies:
- build_x86_release
test_x86_release_octane:
stage: test
before_script:
- rm -f .git/index.lock
- rm -f .git/modules/test/octane/index.lock
- git submodule deinit -f test/octane
- git submodule init
- git submodule update test/octane
- cp out/linux/x86/interpreter/release/escargot ./escargot
script: make run-octane | tail -1 > out/octane_result; if ! cat out/octane_result | grep -c 'Score' > /dev/null; then exit 1; fi
dependencies:
- build_x86_release
test_x86_release_test262:
stage: test
before_script:
- rm -f .git/index.lock
- rm -f .git/modules/test/test262/index.lock
- git submodule deinit -f test/test262
- git submodule init
- git submodule update test/test262
- cp out/linux/x86/interpreter/release/escargot ./escargot
script: make run-test262; exit $?;
dependencies:
- build_x86_release
test_x86_release_jetstream_only_cdjs:
stage: test
before_script:
- rm -f .git/index.lock
- rm -f .git/modules/test/vendortest/index.lock
- git submodule deinit -f test/vendortest
- git submodule init
- git submodule update test/vendortest
- cp out/linux/x86/interpreter/release/escargot ./escargot
script: make run-jetstream-only-cdjs; if cat test/vendortest/driver/jetstream/jetstream-result-raw.res | grep -c 'NaN' > /dev/null; then exit 1; fi; exit $?;
dependencies:
- build_x86_release
test_x86_release_jetstream_only_simple:
stage: test
tags:
- escargot_allow_slow
before_script:
- rm -f .git/index.lock
- rm -f .git/modules/test/vendortest/index.lock
- git submodule deinit -f test/vendortest
- git submodule init
- git submodule update test/vendortest
- cp out/linux/x86/interpreter/release/escargot ./escargot
script: make run-jetstream-only-simple; if cat test/vendortest/driver/jetstream/jetstream-result-raw.res | grep -c 'NaN' > /dev/null; then exit 1; fi; exit $?;
dependencies:
- build_x86_release
test_x86_release_spidermonkey:
stage: test
before_script:
- rm -f .git/index.lock
- rm -f .git/modules/test/vendortest/index.lock
- git submodule deinit -f test/vendortest
- git submodule init
- git submodule update test/vendortest
- cp out/linux/x86/interpreter/release/escargot ./escargot
script: make run-spidermonkey-full; exit $?;
dependencies:
- build_x86_release
test_x86_release_internal:
stage: test
tags:
before_script:
- rm -f .git/index.lock
- rm -f .git/modules/test/vendortest/index.lock
- git submodule deinit -f test/vendortest
- git submodule init
- git submodule update test/vendortest
- cp out/linux/x86/interpreter/release/escargot ./escargot
script: make run-internal-test; exit $?;
dependencies:
- build_x86_release
test_x86_release_v8:
stage: test
tags:
- escargot_allow_slow
before_script:
- rm -f .git/index.lock
- rm -f .git/modules/test/vendortest/index.lock
- git submodule deinit -f test/vendortest
- git submodule init
- git submodule update test/vendortest
- cp out/linux/x86/interpreter/release/escargot ./escargot
script: make run-v8; exit $?;
dependencies:
- build_x86_release
test_x86_release_chakracore:
stage: test
tags:
- escargot_allow_slow
before_script:
- git submodule deinit -f test/vendortest
- git submodule init
- git submodule update test/vendortest
- cp out/linux/x86/interpreter/release/escargot ./escargot
script: make run-chakracore; exit $?;
dependencies:
- build_x86_release
test_x86_release_jsc:
stage: test
tags:
- escargot_allow_slow
before_script:
- git submodule deinit -f test/vendortest
- git submodule init
- git submodule update test/vendortest
- cp out/linux/x86/interpreter/release/escargot ./escargot
script: make run-jsc-stress; exit $?;
dependencies:
- build_x86_release
###############################################################################
build_x64_debug:
stage: build
tags:
- escargot_main_build
before_script:
- unset TIZEN_SDK_HOME
- rm -f .git/index.lock
- rm -f .git/modules/third_party/GCutil/index.lock
- git submodule deinit -f third_party/GCutil
- git submodule init
- git submodule update third_party/GCutil
- ARCH=x64 MODE=debug ./build_third_party.sh
- make clean
script:
- VENDORTEST=1 make x64.interpreter.debug -j$(nproc)
artifacts:
paths:
- out/linux/x64/interpreter/debug/escargot
test_x64_debug_sunspider:
stage: test
before_script:
- rm -f .git/index.lock
- rm -f .git/modules/test/vendortest/index.lock
- git submodule deinit -f test/vendortest
- git submodule init
- git submodule update test/vendortest
- cp out/linux/x64/interpreter/debug/escargot ./escargot
script: ./escargot test/vendortest/SunSpider/tests/sunspider-1.0.2/*.js; exit $?;
dependencies:
- build_x64_debug
#test_x64_debug_octane:
# stage: test
# before_script:
# - git submodule deinit -f test/octane
# - git submodule init
# - git submodule update test/octane
# - cp out/linux/x64/interpreter/debug/escargot ./escargot
# script: make run-octane | tail -1 > out/octane_result; if ! cat out/octane_result | grep -c 'Score' > /dev/null; then exit 1; fi
# dependencies:
# - build_x64_debug
#
#test_x64_debug_test262:
# stage: test
# before_script:
# - git submodule deinit -f test/test262
# - git submodule init
# - git submodule update test/test262
# - cp out/linux/x64/interpreter/debug/escargot ./escargot
# script: make run-test262; exit $?;
# dependencies:
# - build_x64_debug
#
################################################################################
build_x86_debug:
stage: build
tags:
- escargot_main_build
before_script:
- rm -f .git/index.lock
- rm -f .git/modules/third_party/GCutil/index.lock
- unset TIZEN_SDK_HOME
- git submodule deinit -f third_party/GCutil
- git submodule init
- git submodule update third_party/GCutil
- ARCH=x86 MODE=debug ./build_third_party.sh
- make clean
script:
- VENDORTEST=1 make x86.interpreter.debug -j$(nproc)
artifacts:
paths:
- out/linux/x86/interpreter/debug/escargot
test_x86_debug_sunspider:
stage: test
before_script:
- rm -f .git/index.lock
- rm -f .git/modules/test/vendortest/index.lock
- git submodule deinit -f test/vendortest
- git submodule init
- git submodule update test/vendortest
- cp out/linux/x86/interpreter/debug/escargot ./escargot
script: ./escargot test/vendortest/SunSpider/tests/sunspider-1.0.2/*.js; exit $?;
dependencies:
- build_x86_debug
#test_x86_debug_octane:
# stage: test
# before_script:
# - git submodule deinit -f test/octane
# - git submodule init
# - git submodule update test/octane
# - cp out/linux/x86/interpreter/debug/escargot ./escargot
# script: make run-octane | tail -1 > out/octane_result; if ! cat out/octane_result | grep -c 'Score' > /dev/null; then exit 1; fi
# dependencies:
# - build_x86_debug
#
#test_x86_debug_test262:
# stage: test
# before_script:
# - git submodule deinit -f test/test262
# - git submodule init
# - git submodule update test/test262
# script: make run-test262; exit $?;
# dependencies:
# - build_x86_debug
#

59
.gitmodules vendored
View file

@ -1,33 +1,32 @@
[submodule "test/test262"]
path = test/test262
url = git@github.sec.samsung.net:lws-test/test262.git
[submodule "test/test262-master"]
path = test/test262-master
url = git@github.sec.samsung.net:lws-test/test262-master.git
[submodule "test/test262-harness-py"]
path = test/test262-harness-py
url = git@github.sec.samsung.net:lws-test/test262-harness-py.git
[submodule "test/octane"]
path = test/octane
url = git@github.sec.samsung.net:lws-test/octane.git
[submodule "third_party/GCutil"]
path = third_party/GCutil
url = git@github.sec.samsung.net:lws/gcutil.git
[submodule "third_party/checked_arithmetic"]
path = third_party/checked_arithmetic
url = git@github.sec.samsung.net:lws-submodules/checked_arithmetic.git
[submodule "third_party/double_conversion"]
path = third_party/double_conversion
url = git@github.sec.samsung.net:lws-submodules/double_conversion.git
[submodule "third_party/rapidjson"]
path = third_party/rapidjson
url = git@github.sec.samsung.net:lws-submodules/rapidjson.git
[submodule "third_party/yarr"]
path = third_party/yarr
url = git@github.sec.samsung.net:lws-submodules/yarr.git
[submodule "third_party/windows/icu"]
path = third_party/windows/icu
url = git@github.sec.samsung.net:lws-submodules/icu.git
url = https://github.com/Samsung/gcutil.git
ignore = untracked
[submodule "test/vendortest"]
path = test/vendortest
url = git@github.sec.samsung.net:lws-test/js_vendor_tc.git
path = test/vendortest
url = https://github.com/Samsung/js_vendor_tc.git
ignore = untracked
[submodule "test/test262"]
path = test/test262
url = https://github.com/tc39/test262.git
ignore = untracked
[submodule "test/octane"]
path = test/octane
url = https://github.com/chromium/octane.git
ignore = untracked
[submodule "test/kangax"]
path = test/kangax
url = https://github.com/kangax/compat-table.git
ignore = untracked
[submodule "third_party/googletest"]
path = third_party/googletest
url = https://github.com/google/googletest.git
ignore = untracked
[submodule "third_party/walrus"]
path = third_party/walrus
url = https://github.com/Samsung/walrus.git
ignore = untracked
[submodule "test/web-tooling-benchmark"]
path = test/web-tooling-benchmark
url = https://github.com/v8/web-tooling-benchmark
ignore = untracked

View file

@ -1,22 +1,55 @@
CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
CMAKE_MINIMUM_REQUIRED (VERSION 2.8.12 FATAL_ERROR)
PROJECT (ESCARGOT)
# CONFIGURATION
SET (CMAKE_VERBOSE_MAKEFILE true)
#SET (ESCARGOT_HOST "linux" CACHE STRING "ESCARGOT_HOST")
#SET (ESCARGOT_ARCH "x64" CACHE STRING "ESCARGOT_ARCH")
SET (ESCARGOT_TYPE "interpreter" CACHE STRING "ESCARGOT_TYPE")
#SET (ESCARGOT_MODE "debug" CACHE STRING "ESCARGOT_MODE")
#SET (ESCARGOT_OUTPUT "bin" CACHE STRING "ESCARGOT_OUTPUT")
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
MESSAGE(STATUS "CMAKE_SYSTEM_NAME: " ${CMAKE_SYSTEM_NAME})
MESSAGE(STATUS "CMAKE_SYSTEM_PROCESSOR: " ${CMAKE_SYSTEM_PROCESSOR})
IF (NOT DEFINED ESCARGOT_ARCH)
IF (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "X86" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86"
OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686")
SET(ESCARGOT_ARCH "x86")
ELSEIF (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64"
OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "EM64T")
SET(ESCARGOT_ARCH "x64")
ELSEIF (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm32"
OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv7l")
SET(ESCARGOT_ARCH "arm")
ELSEIF (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
SET(ESCARGOT_ARCH "aarch64")
ELSEIF (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "riscv64")
SET(ESCARGOT_ARCH "riscv64")
ENDIF()
ENDIF()
IF (NOT DEFINED ESCARGOT_HOST)
IF (${CMAKE_SYSTEM_NAME} STREQUAL "Windows" OR ${CMAKE_SYSTEM_NAME} STREQUAL "WindowsStore")
SET(ESCARGOT_HOST "windows")
ELSEIF (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
SET(ESCARGOT_HOST "android")
ELSEIF (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
SET(ESCARGOT_HOST "darwin")
ELSE()
SET(ESCARGOT_HOST "linux")
ENDIF()
ENDIF()
IF (NOT DEFINED ESCARGOT_MODE)
SET (ESCARGOT_MODE "release")
ENDIF()
IF (NOT DEFINED ESCARGOT_OUTPUT)
SET (ESCARGOT_OUTPUT "shell")
ENDIF()
IF (NOT DEFINED ESCARGOT_THREADING)
SET (ESCARGOT_THREADING ON)
ENDIF()
SET (ESCARGOT_TARGET escargot)
#SET (REACT_NATIVE) #TODO
#SET (LTO) #TODO
#SET (VENDORTEST) #TODO
SET (ESCARGOT_CCTEST_TARGET cctest)
INCLUDE (ProcessorCount)
PROCESSORCOUNT (NPROCS)
@ -24,6 +57,34 @@ PROCESSORCOUNT (NPROCS)
# INCLUDE CMAKE FILES
INCLUDE (${PROJECT_SOURCE_DIR}/build/config.cmake)
INCLUDE (${PROJECT_SOURCE_DIR}/build/escargot.cmake)
IF (ESCARGOT_OUTPUT STREQUAL "bin")
INCLUDE (${PROJECT_SOURCE_DIR}/build/test.cmake)
# Pkgconfig
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/escargot.pc.in ${CMAKE_BINARY_DIR}/escargot.pc @ONLY)
IF (ESCARGOT_TLS_ACCESS_BY_PTHREAD_KEY AND ESCARGOT_TLS_ACCESS_BY_ADDRESS)
MESSAGE(FATAL_ERROR "You cannot enable ESCARGOT_TLS_ACCESS_BY_PTHREAD_KEY and ESCARGOT_TLS_ACCESS_BY_ADDRESS at same time")
ENDIF()
MESSAGE(STATUS "Escargot Arch: " ${ESCARGOT_ARCH})
MESSAGE(STATUS "Escargot Host: " ${ESCARGOT_HOST})
MESSAGE(STATUS "Escargot Mode: " ${ESCARGOT_MODE})
MESSAGE(STATUS "Escargot Output: " ${ESCARGOT_OUTPUT})
MESSAGE(STATUS "--------------------------------------------------------------------------------")
MESSAGE(STATUS "ESCARGOT_DEFINITIONS: " ${ESCARGOT_DEFINITIONS})
MESSAGE(STATUS "ESCARGOT_CXXFLAGS: " ${ESCARGOT_CXXFLAGS})
MESSAGE(STATUS "ESCARGOT_LDFLAGS: " ${ESCARGOT_LDFLAGS})
MESSAGE(STATUS "ESCARGOT_INCDIRS: " ${ESCARGOT_INCDIRS})
MESSAGE(STATUS "ESCARGOT_LIBRARIES: " ${ESCARGOT_LIBRARIES})
MESSAGE(STATUS "ESCARGOT_LIBICU_SUPPORT: " ${ESCARGOT_LIBICU_SUPPORT})
MESSAGE(STATUS "ESCARGOT_LIBICU_SUPPORT_WITH_DLOPEN: " ${ESCARGOT_LIBICU_SUPPORT_WITH_DLOPEN})
MESSAGE(STATUS "ESCARGOT_SMALL_CONFIG: " ${ESCARGOT_SMALL_CONFIG})
MESSAGE(STATUS "ESCARGOT_CODE_CACHE: " ${ESCARGOT_CODE_CACHE})
MESSAGE(STATUS "ESCARGOT_WASM: " ${ESCARGOT_WASM})
MESSAGE(STATUS "ESCARGOT_THREADING: " ${ESCARGOT_THREADING})
MESSAGE(STATUS "ESCARGOT_TLS_ACCESS_BY_ADDRESS: " ${ESCARGOT_TLS_ACCESS_BY_ADDRESS})
MESSAGE(STATUS "ESCARGOT_TLS_ACCESS_BY_PTHREAD_KEY: " ${ESCARGOT_TLS_ACCESS_BY_PTHREAD_KEY})
MESSAGE(STATUS "ESCARGOT_EXPORT_ALL: " ${ESCARGOT_EXPORT_ALL})
MESSAGE(STATUS "ESCARGOT_TCO: " ${ESCARGOT_TCO})
MESSAGE(STATUS "ESCARGOT_TEMPORAL: " ${ESCARGOT_TEMPORAL})
MESSAGE(STATUS "ESCARGOT_SHADOWREALM: " ${ESCARGOT_SHADOWREALM})
MESSAGE(STATUS "ESCARGOT_TEST: " ${ESCARGOT_TEST})

524
LICENSE Normal file
View file

@ -0,0 +1,524 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

33
LICENSE.BOEHM-GC Normal file
View file

@ -0,0 +1,33 @@
MIT-style License
Copyright (c) 1988-1989 Hans-J. Boehm, Alan J. Demers
Copyright (c) 1991-1996 by Xerox Corporation. All rights reserved.
Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
Copyright (c) 1998 by Fergus Henderson. All rights reserved.
Copyright (c) 1999-2001 by Red Hat, Inc. All rights reserved.
Copyright (c) 1999-2011 Hewlett-Packard Development Company, L.P.
Copyright (c) 2004-2005 Andrei Polushin
Copyright (c) 2007 Free Software Foundation, Inc.
Copyright (c) 2008-2022 Ivan Maidanski
Copyright (c) 2011 Ludovic Courtes
Copyright (c) 2018 Petter A. Urkedal
THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
Permission is hereby granted to use or copy this program
for any purpose, provided the above notices are retained on all copies.
Permission to modify the code and to distribute modified code is granted,
provided the above notices are retained, and a notice that the code was
modified is included with the above copyright notice.
Several files (gc/gc_allocator.h, extra/msvc_dbg.c) come with slightly
different licenses, though they are all similar in spirit (the exact
licensing terms are given at the beginning of the corresponding source file).
A few of the files needed to use the GNU-style build procedure come with
a modified GPL license that appears not to significantly restrict use of
the collector, though use of those files for a purpose other than building
the collector may require the resulting code to be covered by the GPL.

467
Makefile
View file

@ -1,467 +0,0 @@
BUILDDIR=./build
TOOLSDIR=./tools
HOST=linux
BIN=escargot
SHARED_LIB=libescargot.so
STATIC_LIB=libescargot.a
#######################################################
# Environments
#######################################################
CFLAGS_FROM_ENV:=$(CFLAGS)
CXXFLAGS_FROM_ENV:=$(CXXFLAGS)
ARCH=#x86,x64
TYPE=none#interpreter
MODE=#debug,release
NPROCS:=1
OS:=$(shell uname -s)
SHELL:=/bin/bash
OUTPUT=
LTO=
QUIET=@
ifeq ($(OS),Linux)
NPROCS:=$(shell grep -c ^processor /proc/cpuinfo)
SHELL:=/bin/bash
endif
ifeq ($(OS),Darwin)
NPROCS:=$(shell sysctl -n machdep.cpu.thread_count)
SHELL:=/opt/local/bin/bash
endif
$(info goal... $(MAKECMDGOALS))
ifneq (,$(findstring x86,$(MAKECMDGOALS)))
ARCH=x86
else ifneq (,$(findstring x64,$(MAKECMDGOALS)))
ARCH=x64
else ifneq (,$(findstring arm,$(MAKECMDGOALS)))
ARCH=arm
else ifneq (,$(findstring aarch64,$(MAKECMDGOALS)))
ARCH=aarch64
else ifneq (,$(findstring i686,$(MAKECMDGOALS)))
ARCH=i686
else ifneq (,$(findstring x86_64,$(MAKECMDGOALS)))
ARCH=x86_64
endif
ifneq (,$(findstring interpreter,$(MAKECMDGOALS)))
TYPE=interpreter
endif
ifneq (,$(findstring debug,$(MAKECMDGOALS)))
MODE=debug
else ifneq (,$(findstring release,$(MAKECMDGOALS)))
MODE=release
endif
ifneq (,$(findstring tizen_wearable_arm,$(MAKECMDGOALS)))
HOST=tizen_2.3.1_wearable
VERSION=2.3.1
TIZEN_PROFILE=wearable
else ifneq (,$(findstring tizen3_wearable_arm,$(MAKECMDGOALS)))
HOST=tizen_3.0_wearable
VERSION=3.0
TIZEN_PROFILE=wearable
else ifneq (,$(findstring tizen_mobile_arm,$(MAKECMDGOALS)))
HOST=tizen_2.3.1_mobile
VERSION=2.3.1
TIZEN_PROFILE=mobile
else ifneq (,$(findstring tizen3_mobile_arm,$(MAKECMDGOALS)))
HOST=tizen_3.0_mobile
VERSION=3.0
TIZEN_PROFILE=mobile
else ifneq (,$(findstring tizen_wearable_emulator,$(MAKECMDGOALS)))
HOST=tizen_2.3.1_wearable
VERSION=2.3.1
ARCH=i386
TIZEN_PROFILE=wearable
else ifneq (,$(findstring tizen3_wearable_emulator,$(MAKECMDGOALS)))
HOST=tizen_3.0_wearable
VERSION=3.0
ARCH=i386
TIZEN_PROFILE=wearable
else ifneq (,$(findstring tizen24_mobile_emulator,$(MAKECMDGOALS)))
HOST=tizen_2.4_mobile
VERSION=2.4
ARCH=i386
TIZEN_PROFILE=mobile
else ifneq (,$(findstring tizen24_mobile_arm,$(MAKECMDGOALS)))
HOST=tizen_2.4_mobile
VERSION=2.4
ARCH=arm
TIZEN_PROFILE=mobile
else ifneq (,$(findstring tizen_obs_arm,$(MAKECMDGOALS)))
HOST=tizen_obs
ARCH=arm
else ifneq (,$(findstring tizen_obs_aarch64,$(MAKECMDGOALS)))
HOST=tizen_obs
ARCH=aarch64
else ifneq (,$(findstring tizen_obs_i686,$(MAKECMDGOALS)))
HOST=tizen_obs
ARCH=i686
else ifneq (,$(findstring tizen_obs_x86_64,$(MAKECMDGOALS)))
HOST=tizen_obs
ARCH=x86_64
else ifneq (,$(findstring android,$(MAKECMDGOALS)))
HOST=android
ARCH=arm
endif
ifneq (,$(findstring tizen,$(HOST)))
#LTO=1
endif
ifneq (,$(findstring shared,$(MAKECMDGOALS)))
OUTPUT=shared_lib
else ifneq (,$(findstring static,$(MAKECMDGOALS)))
OUTPUT=static_lib
else
OUTPUT=bin
endif
ifeq ($(HOST),tizen_obs)
QUIET=
endif
OUTDIR=out/$(HOST)/$(ARCH)/$(TYPE)/$(MODE)
ESCARGOT_ROOT=.
$(info host... $(HOST))
$(info arch... $(ARCH))
$(info type... $(TYPE))
$(info mode... $(MODE))
$(info output... $(OUTPUT))
$(info build dir... $(OUTDIR))
#######################################################
# Build flags
#######################################################
include $(BUILDDIR)/Toolchain.mk
include $(BUILDDIR)/Flags.mk
# common flags
CXXFLAGS += $(ESCARGOT_CXXFLAGS_COMMON)
LDFLAGS += $(ESCARGOT_LDFLAGS_COMMON)
# HOST flags
ifeq ($(HOST), linux)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_LINUX)
else ifneq (,$(findstring tizen,$(HOST)))
CXXFLAGS += $(ESCARGOT_CXXFLAGS_TIZEN)
endif
# ARCH flags
ifeq ($(ARCH), x64)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_X64)
LDFLAGS += $(ESCARGOT_LDFLAGS_X64)
else ifeq ($(ARCH), x86)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_X86)
LDFLAGS += $(ESCARGOT_LDFLAGS_X86)
else ifeq ($(ARCH), i686)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_X86)
LDFLAGS += $(ESCARGOT_LDFLAGS_X86)
else ifeq ($(ARCH), arm)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_ARM)
LDFLAGS += $(ESCARGOT_LDFLAGS_ARM)
else ifeq ($(ARCH), aarch64)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_AARCH64)
LDFLAGS += $(ESCARGOT_LDFLAGS_AARCH64)
else ifeq ($(ARCH), x86_64)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_X64)
LDFLAGS += $(ESCARGOT_LDFLAGS_X64)
endif
# TYPE flags
ifeq ($(TYPE), interpreter)
CXXFLAGS+=$(ESCARGOT_CXXFLAGS_INTERPRETER)
CXXFLAGS+=$(ESCARGOT_CXXFLAGS_JIT)
endif
# MODE flags
ifeq ($(MODE), debug)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_DEBUG)
else ifeq ($(MODE), release)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_RELEASE)
endif
# OUTPUT flags
ifeq ($(OUTPUT), bin)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_BIN)
LDFLAGS += $(ESCARGOT_LDFLAGS_BIN)
else ifeq ($(OUTPUT), shared_lib)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_SHAREDLIB)
LDFLAGS += $(ESCARGOT_LDFLAGS_SHAREDLIB)
else ifeq ($(OUTPUT), static_lib)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_STATICLIB)
LDFLAGS += $(ESCARGOT_LDFLAGS_STATICLIB)
endif
CXXFLAGS += $(ESCARGOT_CXXFLAGS_THIRD_PARTY)
LDFLAGS += $(ESCARGOT_LDFLAGS_THIRD_PARTY)
ifeq ($(VENDORTEST), 1)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_VENDORTEST)
endif
ifeq ($(LTO), 1)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_LTO)
LDFLAGS += $(ESCARGOT_LDFLAGS_LTO)
ifeq ($(OUTPUT), bin)
LDFLAGS += $(CXXFLAGS)
endif
endif
#######################################################
# SRCS & OBJS
#######################################################
SRC=
SRC += $(foreach dir, src , $(wildcard $(dir)/*.cpp))
SRC += $(foreach dir, src/api , $(wildcard $(dir)/*.cpp))
SRC += $(foreach dir, src/heap , $(wildcard $(dir)/*.cpp))
SRC += $(foreach dir, src/interpreter , $(wildcard $(dir)/*.cpp))
SRC += $(foreach dir, src/parser , $(wildcard $(dir)/*.cpp))
SRC += $(foreach dir, src/parser/ast , $(wildcard $(dir)/*.cpp))
SRC += $(foreach dir, src/parser/esprima_cpp , $(wildcard $(dir)/*.cpp))
SRC += $(foreach dir, src/runtime , $(wildcard $(dir)/*.cpp))
SRC += $(foreach dir, src/util , $(wildcard $(dir)/*.cpp))
ifeq ($(OUTPUT), bin)
SRC += $(foreach dir, src/shell , $(wildcard $(dir)/*.cpp))
CXXFLAGS += -DESCARGOT_SHELL
endif
SRC += $(foreach dir, third_party/yarr, $(wildcard $(dir)/*.cpp))
SRC += $(foreach dir, third_party/GCutil, $(wildcard $(dir)/*.cpp))
SRC_CC =
SRC_CC += $(foreach dir, third_party/double_conversion , $(wildcard $(dir)/*.cc))
OBJS := $(SRC:%.cpp= $(OUTDIR)/%.o)
OBJS += $(SRC_CC:%.cc= $(OUTDIR)/%.o)
OBJS += $(SRC_C:%.c= $(OUTDIR)/%.o)
ifeq ($(OUTPUT), bin)
OBJS_GC=third_party/GCutil/bdwgc/out/$(HOST)/$(ARCH)/$(MODE).static/.libs/libgc.a
else
OBJS_GC=
ifneq (,$(findstring standalone,$(MAKECMDGOALS)))
OBJS_GC=third_party/GCutil/bdwgc/out/$(HOST)/$(ARCH)/$(MODE).shared/.libs/libgc.a
endif
endif
#######################################################
# Targets
#######################################################
# pull in dependency info for *existing* .o files
-include $(OBJS:.o=.d)
x86.interpreter.debug: $(OUTDIR)/$(BIN)
cp -f $< .
x86.interpreter.release: $(OUTDIR)/$(BIN)
cp -f $< .
x86.interpreter.debug.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
x86.interpreter.release.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
x86.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
x86.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
x86.interpreter.debug.shared.standalone: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
x86.interpreter.release.shared.standalone: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
x86.interpreter.debug.static.standalone: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
x86.interpreter.release.static.standalone: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
x64.interpreter.debug: $(OUTDIR)/$(BIN)
cp -f $< .
x64.interpreter.release: $(OUTDIR)/$(BIN)
cp -f $< .
x64.interpreter.debug.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
x64.interpreter.release.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
x64.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
x64.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
x64.interpreter.debug.shared.standalone: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
x64.interpreter.release.shared.standalone: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
x64.interpreter.debug.static.standalone: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
x64.interpreter.release.static.standalone: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
#tizen_mobile_arm.interpreter.debug: $(OUTDIR)/$(BIN)
# cp -f $< .
#tizen_mobile_arm.interpreter.release: $(OUTDIR)/$(BIN)
# cp -f $< .
tizen_mobile_arm.interpreter.release.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
#tizen_mobile_arm.interpreter.debug: $(OUTDIR)/$(BIN)
# cp -f $< .
#tizen_mobile_arm.interpreter.release: $(OUTDIR)/$(BIN)
# cp -f $< .
tizen_wearable_arm.interpreter.release: $(OUTDIR)/$(BIN)
cp -f $< .
tizen_wearable_arm.interpreter.debug: $(OUTDIR)/$(BIN)
cp -f $< .
tizen_wearable_arm.interpreter.release.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
tizen_wearable_arm.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
tizen_wearable_arm.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
tizen_wearable_emulator.interpreter.release.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
tizen_wearable_emulator.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
tizen_wearable_emulator.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
##### TIZEN_OBS #####
tizen_obs_arm.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
tizen_obs_i386.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
tizen_obs_arm.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
tizen_obs_i386.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
tizen_obs_arm.interpreter.release: $(OUTDIR)/$(BIN)
tizen_obs_i386.interpreter.release: $(OUTDIR)/$(BIN)
tizen_obs_arm.interpreter.debug: $(OUTDIR)/$(BIN)
tizen_obs_i386.interpreter.debug: $(OUTDIR)/$(BIN)
tizen_obs_aarch64.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
tizen_obs_aarch64.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
tizen_obs_aarch64.interpreter.release: $(OUTDIR)/$(BIN)
tizen_obs_aarch64.interpreter.debug: $(OUTDIR)/$(BIN)
tizen_obs_i686.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
tizen_obs_i686.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
tizen_obs_i686.interpreter.release: $(OUTDIR)/$(BIN)
tizen_obs_i686.interpreter.debug: $(OUTDIR)/$(BIN)
tizen_obs_x86_64.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
tizen_obs_x86_64.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
tizen_obs_x86_64.interpreter.release: $(OUTDIR)/$(BIN)
tizen_obs_x86_64.interpreter.debug: $(OUTDIR)/$(BIN)
##### TIZEN24 #####
tizen24_mobile_emulator.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
tizen24_mobile_emulator.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
tizen24_mobile_arm.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
tizen24_mobile_arm.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
##### TIZEN3 #####
#tizen3_mobile_arm.interpreter.debug: $(OUTDIR)/$(BIN)
# cp -f $< .
#tizen3_mobile_arm.interpreter.release: $(OUTDIR)/$(BIN)
# cp -f $< .
tizen3_mobile_arm.interpreter.release.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
#tizen3_mobile_arm.interpreter.debug: $(OUTDIR)/$(BIN)
# cp -f $< .
#tizen3_mobile_arm.interpreter.release: $(OUTDIR)/$(BIN)
# cp -f $< .
tizen3_wearable_arm.interpreter.release: $(OUTDIR)/$(BIN)
cp -f $< .
tizen3_wearable_arm.interpreter.debug: $(OUTDIR)/$(BIN)
cp -f $< .
tizen3_wearable_arm.interpreter.release.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
tizen3_wearable_arm.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
tizen3_wearable_arm.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
tizen3_wearable_emulator.interpreter.release.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
tizen3_wearable_emulator.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
tizen3_wearable_emulator.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
android.interpreter.debug: $(OUTDIR)/$(BIN)
cp -f $< .
android.interpreter.release: $(OUTDIR)/$(BIN)
cp -f $< .
android.interpreter.debug.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
android.interpreter.release.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
android.interpreter.debug.shared.standalone: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
android.interpreter.release.shared.standalone: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
android.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
android.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
android.interpreter.debug.static.standalone: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
android.interpreter.release.static.standalone: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
DEPENDENCY_MAKEFILE = Makefile $(BUILDDIR)/Toolchain.mk $(BUILDDIR)/Flags.mk
$(OUTDIR)/$(BIN): $(OBJS) $(OBJS_GC) $(DEPENDENCY_MAKEFILE)
@echo "[LINK] $@"
$(QUIET) $(CXX) -o $@ $(OBJS) $(OBJS_GC) $(LDFLAGS)
$(OUTDIR)/$(SHARED_LIB): $(OBJS) $(OBJS_GC) $(DEPENDENCY_MAKEFILE)
@echo "[LINK] $@"
$(CXX) -shared -Wl,-soname,$(SHARED_LIB) -o $@ $(OBJS) $(OBJS_GC) $(LDFLAGS)
$(OUTDIR)/$(STATIC_LIB): $(OBJS) $(DEPENDENCY_MAKEFILE)
@echo "[LINK] $@"
$(AR) rc $@ $(ARFLAGS) $(OBJS)
$(OUTDIR)/%.o: %.cpp $(DEPENDENCY_MAKEFILE)
@echo "[CXX] $@"
@mkdir -p $(dir $@)
$(QUIET) $(CXX) -c $(CXXFLAGS) $(CXXFLAGS_FROM_ENV) $< -o $@
@$(CXX) -MM $(CXXFLAGS) -MT $@ $< > $(OUTDIR)/$*.d
$(OUTDIR)/%.o: %.cc $(DEPENDENCY_MAKEFILE)
@echo "[CXX] $@"
@mkdir -p $(dir $@)
$(QUIET) @$(CXX) -c $(CXXFLAGS) $(CXXFLAGS_FROM_ENV) $< -o $@
@$(CXX) -MM $(CXXFLAGS) -MT $@ $< > $(OUTDIR)/$*.d
install_header_to_include:
cp -f src/api/EscargotPublic.h ./include/
cp -f third_party/GCutil/GCUtil.h ./include/
cp -f third_party/GCutil/Allocator.h ./include/
cp -f third_party/GCutil/LeakChecker.h ./include/
cp -f third_party/GCutil/bdwgc/include/gc.h ./include/
cp -f third_party/GCutil/bdwgc/include/gc_mark.h ./include/
cp -f third_party/GCutil/bdwgc/include/gc_typed.h ./include/
cp -f third_party/GCutil/bdwgc/include/gc_allocator.h ./include/
cp -f third_party/GCutil/bdwgc/include/gc_cpp.h ./include/
cp -f third_party/GCutil/bdwgc/include/gc_version.h ./include/
cp -f third_party/GCutil/bdwgc/include/gc_config_macros.h ./include/
clean:
rm -rf out
.PHONY: clean install_header_to_include
#######################################################
# Test
#######################################################
include $(BUILDDIR)/TestCC.mk
include $(BUILDDIR)/TestJS.mk

View file

@ -1,433 +0,0 @@
BUILDDIR=./build
TOOLSDIR=./tools
HOST=linux
BIN=escargot
SHARED_LIB=libescargot.so
STATIC_LIB=libescargot.a
#######################################################
# Environments
#######################################################
CFLAGS_FROM_ENV:=$(CFLAGS)
CXXFLAGS_FROM_ENV:=$(CXXFLAGS)
ARCH=#x86,x64
TYPE=none#interpreter
MODE=#debug,release
NPROCS:=1
OS:=$(shell uname -s)
SHELL:=/bin/bash
OUTPUT=
LTO=
QUIET=
ifeq ($(OS),Linux)
NPROCS:=$(shell grep -c ^processor /proc/cpuinfo)
SHELL:=/bin/bash
endif
ifeq ($(OS),Darwin)
NPROCS:=$(shell sysctl -n machdep.cpu.thread_count)
SHELL:=/opt/local/bin/bash
endif
$(info goal... $(MAKECMDGOALS))
ifneq (,$(findstring x86,$(MAKECMDGOALS)))
ARCH=x86
else ifneq (,$(findstring x64,$(MAKECMDGOALS)))
ARCH=x64
else ifneq (,$(findstring arm,$(MAKECMDGOALS)))
ARCH=arm
endif
ifneq (,$(findstring interpreter,$(MAKECMDGOALS)))
TYPE=interpreter
endif
ifneq (,$(findstring debug,$(MAKECMDGOALS)))
MODE=debug
else ifneq (,$(findstring release,$(MAKECMDGOALS)))
MODE=release
endif
ifneq (,$(findstring tizen_wearable_arm,$(MAKECMDGOALS)))
HOST=tizen_2.3.1_wearable
VERSION=2.3.1
TIZEN_PROFILE=wearable
else ifneq (,$(findstring tizen3_wearable_arm,$(MAKECMDGOALS)))
HOST=tizen_3.0_wearable
VERSION=3.0
TIZEN_PROFILE=wearable
else ifneq (,$(findstring tizen_mobile_arm,$(MAKECMDGOALS)))
HOST=tizen_2.3.1_mobile
VERSION=2.3.1
TIZEN_PROFILE=mobile
else ifneq (,$(findstring tizen3_mobile_arm,$(MAKECMDGOALS)))
HOST=tizen_3.0_mobile
VERSION=3.0
TIZEN_PROFILE=mobile
else ifneq (,$(findstring tizen_wearable_emulator,$(MAKECMDGOALS)))
HOST=tizen_2.3.1_wearable
VERSION=2.3.1
ARCH=i386
TIZEN_PROFILE=wearable
else ifneq (,$(findstring tizen3_wearable_emulator,$(MAKECMDGOALS)))
HOST=tizen_3.0_wearable
VERSION=3.0
ARCH=i386
TIZEN_PROFILE=wearable
else ifneq (,$(findstring tizen24_mobile_emulator,$(MAKECMDGOALS)))
HOST=tizen_2.4_mobile
VERSION=2.4
ARCH=i386
TIZEN_PROFILE=mobile
else ifneq (,$(findstring tizen24_mobile_arm,$(MAKECMDGOALS)))
HOST=tizen_2.4_mobile
VERSION=2.4
ARCH=arm
TIZEN_PROFILE=mobile
else ifneq (,$(findstring tizen_obs_arm,$(MAKECMDGOALS)))
HOST=tizen_obs
else ifneq (,$(findstring tizen_obs_i386,$(MAKECMDGOALS)))
HOST=tizen_obs
ARCH=i386
else ifneq (,$(findstring android,$(MAKECMDGOALS)))
HOST=android
ARCH=arm
endif
ifneq (,$(findstring tizen,$(HOST)))
#LTO=1
endif
ifneq (,$(findstring shared,$(MAKECMDGOALS)))
OUTPUT=shared_lib
else ifneq (,$(findstring static,$(MAKECMDGOALS)))
OUTPUT=static_lib
else
OUTPUT=bin
endif
ifeq ($(HOST),tizen_obs)
QUIET=
endif
OUTDIR=out/$(HOST)/$(ARCH)/$(TYPE)/$(MODE)
ESCARGOT_ROOT=.
$(info host... $(HOST))
$(info arch... $(ARCH))
$(info type... $(TYPE))
$(info mode... $(MODE))
$(info output... $(OUTPUT))
$(info build dir... $(OUTDIR))
#######################################################
# Build flags
#######################################################
include $(BUILDDIR)/ToolchainClang.mk
include $(BUILDDIR)/FlagsClang.mk
# common flags
CXXFLAGS += $(ESCARGOT_CXXFLAGS_COMMON)
LDFLAGS += $(ESCARGOT_LDFLAGS_COMMON)
# HOST flags
ifeq ($(HOST), linux)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_LINUX)
else ifneq (,$(findstring tizen,$(HOST)))
CXXFLAGS += $(ESCARGOT_CXXFLAGS_TIZEN)
endif
# ARCH flags
ifeq ($(ARCH), x64)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_X64)
LDFLAGS += $(ESCARGOT_LDFLAGS_X64)
else ifeq ($(ARCH), x86)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_X86)
LDFLAGS += $(ESCARGOT_LDFLAGS_X86)
else ifeq ($(ARCH), i386)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_X86)
LDFLAGS += $(ESCARGOT_LDFLAGS_X86)
else ifeq ($(ARCH), arm)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_ARM)
LDFLAGS += $(ESCARGOT_LDFLAGS_ARM)
endif
# TYPE flags
ifeq ($(TYPE), interpreter)
CXXFLAGS+=$(ESCARGOT_CXXFLAGS_INTERPRETER)
CXXFLAGS+=$(ESCARGOT_CXXFLAGS_JIT)
endif
# MODE flags
ifeq ($(MODE), debug)
CXXFLAGS:=$(ESCARGOT_CXXFLAGS_DEBUG) $(CXXFLAGS)
else ifeq ($(MODE), release)
CXXFLAGS:=$(ESCARGOT_CXXFLAGS_RELEASE) $(CXXFLAGS)
endif
# OUTPUT flags
ifeq ($(OUTPUT), bin)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_BIN)
LDFLAGS += $(ESCARGOT_LDFLAGS_BIN)
else ifeq ($(OUTPUT), shared_lib)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_SHAREDLIB)
LDFLAGS += $(ESCARGOT_LDFLAGS_SHAREDLIB)
else ifeq ($(OUTPUT), static_lib)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_STATICLIB)
LDFLAGS += $(ESCARGOT_LDFLAGS_STATICLIB)
endif
CXXFLAGS += $(ESCARGOT_CXXFLAGS_THIRD_PARTY)
LDFLAGS += $(ESCARGOT_LDFLAGS_THIRD_PARTY)
ifeq ($(VENDORTEST), 1)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_VENDORTEST)
endif
ifeq ($(LTO), 1)
CXXFLAGS += $(ESCARGOT_CXXFLAGS_LTO)
LDFLAGS += $(ESCARGOT_LDFLAGS_LTO)
ifeq ($(OUTPUT), bin)
LDFLAGS += $(CXXFLAGS)
endif
endif
#######################################################
# SRCS & OBJS
#######################################################
SRC=
SRC += $(foreach dir, src , $(wildcard $(dir)/*.cpp))
SRC += $(foreach dir, src/api , $(wildcard $(dir)/*.cpp))
SRC += $(foreach dir, src/heap , $(wildcard $(dir)/*.cpp))
SRC += $(foreach dir, src/interpreter , $(wildcard $(dir)/*.cpp))
SRC += $(foreach dir, src/parser , $(wildcard $(dir)/*.cpp))
SRC += $(foreach dir, src/parser/ast , $(wildcard $(dir)/*.cpp))
SRC += $(foreach dir, src/parser/esprima_cpp , $(wildcard $(dir)/*.cpp))
SRC += $(foreach dir, src/runtime , $(wildcard $(dir)/*.cpp))
SRC += $(foreach dir, src/util , $(wildcard $(dir)/*.cpp))
ifeq ($(OUTPUT), bin)
SRC += $(foreach dir, src/shell , $(wildcard $(dir)/*.cpp))
CXXFLAGS += -DESCARGOT_SHELL
endif
SRC += $(foreach dir, third_party/yarr, $(wildcard $(dir)/*.cpp))
SRC += $(foreach dir, third_party/GCutil, $(wildcard $(dir)/*.cpp))
SRC_CC =
SRC_CC += $(foreach dir, third_party/double_conversion , $(wildcard $(dir)/*.cc))
OBJS := $(SRC:%.cpp= $(OUTDIR)/%.o)
OBJS += $(SRC_CC:%.cc= $(OUTDIR)/%.o)
OBJS += $(SRC_C:%.c= $(OUTDIR)/%.o)
ifeq ($(OUTPUT), bin)
OBJS_GC=third_party/GCutil/bdwgc/out/$(HOST)/$(ARCH)/$(MODE).static/.libs/libgc.a
else
OBJS_GC=
ifneq (,$(findstring standalone,$(MAKECMDGOALS)))
OBJS_GC=third_party/GCutil/bdwgc/out/$(HOST)/$(ARCH)/$(MODE).shared/.libs/libgc.a
endif
endif
#######################################################
# Targets
#######################################################
# pull in dependency info for *existing* .o files
-include $(OBJS:.o=.d)
x86.interpreter.debug: $(OUTDIR)/$(BIN)
cp -f $< .
x86.interpreter.release: $(OUTDIR)/$(BIN)
cp -f $< .
x86.interpreter.debug.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
x86.interpreter.release.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
x86.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
x86.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
x86.interpreter.debug.shared.standalone: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
x86.interpreter.release.shared.standalone: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
x86.interpreter.debug.static.standalone: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
x86.interpreter.release.static.standalone: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
x64.interpreter.debug: $(OUTDIR)/$(BIN)
cp -f $< .
x64.interpreter.release: $(OUTDIR)/$(BIN)
cp -f $< .
x64.interpreter.debug.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
x64.interpreter.release.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
x64.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
x64.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
x64.interpreter.debug.shared.standalone: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
x64.interpreter.release.shared.standalone: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
x64.interpreter.debug.static.standalone: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
x64.interpreter.release.static.standalone: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
#tizen_mobile_arm.interpreter.debug: $(OUTDIR)/$(BIN)
# cp -f $< .
#tizen_mobile_arm.interpreter.release: $(OUTDIR)/$(BIN)
# cp -f $< .
tizen_mobile_arm.interpreter.release.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
#tizen_mobile_arm.interpreter.debug: $(OUTDIR)/$(BIN)
# cp -f $< .
#tizen_mobile_arm.interpreter.release: $(OUTDIR)/$(BIN)
# cp -f $< .
tizen_wearable_arm.interpreter.release: $(OUTDIR)/$(BIN)
cp -f $< .
tizen_wearable_arm.interpreter.debug: $(OUTDIR)/$(BIN)
cp -f $< .
tizen_wearable_arm.interpreter.release.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
tizen_wearable_arm.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
tizen_wearable_arm.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
tizen_wearable_emulator.interpreter.release.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
tizen_wearable_emulator.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
tizen_wearable_emulator.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
##### TIZEN_OBS #####
tizen_obs_arm.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
tizen_obs_i386.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
tizen_obs_arm.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
tizen_obs_i386.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
tizen_obs_arm.interpreter.release: $(OUTDIR)/$(BIN)
tizen_obs_i386.interpreter.release: $(OUTDIR)/$(BIN)
tizen_obs_arm.interpreter.debug: $(OUTDIR)/$(BIN)
tizen_obs_i386.interpreter.debug: $(OUTDIR)/$(BIN)
##### TIZEN24 #####
tizen24_mobile_emulator.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
tizen24_mobile_emulator.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
tizen24_mobile_arm.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
tizen24_mobile_arm.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
##### TIZEN3 #####
#tizen3_mobile_arm.interpreter.debug: $(OUTDIR)/$(BIN)
# cp -f $< .
#tizen3_mobile_arm.interpreter.release: $(OUTDIR)/$(BIN)
# cp -f $< .
tizen3_mobile_arm.interpreter.release.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
#tizen3_mobile_arm.interpreter.debug: $(OUTDIR)/$(BIN)
# cp -f $< .
#tizen3_mobile_arm.interpreter.release: $(OUTDIR)/$(BIN)
# cp -f $< .
tizen3_wearable_arm.interpreter.release: $(OUTDIR)/$(BIN)
cp -f $< .
tizen3_wearable_arm.interpreter.debug: $(OUTDIR)/$(BIN)
cp -f $< .
tizen3_wearable_arm.interpreter.release.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
tizen3_wearable_arm.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
tizen3_wearable_arm.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
tizen3_wearable_emulator.interpreter.release.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
tizen3_wearable_emulator.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
tizen3_wearable_emulator.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
android.interpreter.debug: $(OUTDIR)/$(BIN)
cp -f $< .
android.interpreter.release: $(OUTDIR)/$(BIN)
cp -f $< .
android.interpreter.debug.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
android.interpreter.release.shared: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
android.interpreter.debug.shared.standalone: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
android.interpreter.release.shared.standalone: $(OUTDIR)/$(SHARED_LIB)
cp -f $< .
android.interpreter.debug.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
android.interpreter.release.static: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
android.interpreter.debug.static.standalone: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
android.interpreter.release.static.standalone: $(OUTDIR)/$(STATIC_LIB)
cp -f $< .
DEPENDENCY_MAKEFILE = MakefileClang $(BUILDDIR)/ToolchainClang.mk $(BUILDDIR)/FlagsClang.mk
$(OUTDIR)/$(BIN): $(OBJS) $(OBJS_GC) $(DEPENDENCY_MAKEFILE)
@echo "[LINK] $@"
$(QUIET) $(CXX) -o $@ $(OBJS) $(OBJS_GC) $(LDFLAGS)
$(OUTDIR)/$(SHARED_LIB): $(OBJS) $(OBJS_GC) $(DEPENDENCY_MAKEFILE)
@echo "[LINK] $@"
$(CXX) -shared -Wl,-soname,$(SHARED_LIB) -o $@ $(OBJS) $(OBJS_GC) $(LDFLAGS)
$(OUTDIR)/$(STATIC_LIB): $(OBJS) $(DEPENDENCY_MAKEFILE)
@echo "[LINK] $@"
$(AR) rc $@ $(ARFLAGS) $(OBJS)
$(OUTDIR)/%.o: %.cpp $(DEPENDENCY_MAKEFILE)
@echo "[CXX] $@"
@mkdir -p $(dir $@)
$(QUIET) $(CXX) -c $(CXXFLAGS) $(CXXFLAGS_FROM_ENV) $< -o $@
@$(CXX) -MM $(CXXFLAGS) -MT $@ $< > $(OUTDIR)/$*.d
$(OUTDIR)/%.o: %.cc $(DEPENDENCY_MAKEFILE)
@echo "[CXX] $@"
@mkdir -p $(dir $@)
$(QUIET) @$(CXX) -c $(CXXFLAGS) $(CXXFLAGS_FROM_ENV) $< -o $@
@$(CXX) -MM $(CXXFLAGS) -MT $@ $< > $(OUTDIR)/$*.d
install_header_to_include:
cp -f src/api/EscargotPublic.h ./include/
cp -f third_party/GCutil/GCUtil.h ./include/
cp -f third_party/GCutil/Allocator.h ./include/
cp -f third_party/GCutil/LeakChecker.h ./include/
cp -f third_party/GCutil/bdwgc/include/gc.h ./include/
cp -f third_party/GCutil/bdwgc/include/gc_mark.h ./include/
cp -f third_party/GCutil/bdwgc/include/gc_typed.h ./include/
cp -f third_party/GCutil/bdwgc/include/gc_allocator.h ./include/
cp -f third_party/GCutil/bdwgc/include/gc_cpp.h ./include/
cp -f third_party/GCutil/bdwgc/include/gc_version.h ./include/
cp -f third_party/GCutil/bdwgc/include/gc_config_macros.h ./include/
clean:
rm -rf out
.PHONY: clean install_header_to_include
#######################################################
# Test
#######################################################
include $(BUILDDIR)/TestCC.mk
include $(BUILDDIR)/TestJS.mk

219
README.md
View file

@ -1,53 +1,194 @@
# Escargot
## Prerequisites
```
apt-get install autoconf automake libtool libc++-dev libicu-dev gcc-multilib g++-multilib
[![License](https://img.shields.io/badge/License-LGPL%20v2.1-blue.svg)](LICENSE)
[![GitHub release (latestSemVer)](https://img.shields.io/github/v/release/Samsung/escargot)](https://github.com/Samsung/escargot/releases)
[![Actions Status](https://github.com/Samsung/escargot/workflows/ES-Actions/badge.svg)](https://github.com/Samsung/escargot/actions/workflows/es-actions.yml)
[![Coverity Scan Build Status](https://scan.coverity.com/projects/21647/badge.svg)](https://scan.coverity.com/projects/samsung-escargot)
[![codecov](https://codecov.io/gh/Samsung/escargot/branch/master/graph/badge.svg?token=DX8CN6E7A8)](https://codecov.io/gh/Samsung/escargot)
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.
| **Option** | **Description** | **Flag** | **Value** | **Default** |
|-|-|-|-|-|
| **HOST** | Choose target platform | -DESCARGOT_HOST | linux/darwin/android/windows | |
| **ARCH** | Choose target architecture | -DESCARGOT_ARCH | x64/x86/arm/aarch64 | |
| **MODE** | Choose release/debug mode | -DESCARGOT_MODE | release/debug | release |
| **OUTPUT** | Choose build output type | -DESCARGOT_OUTPUT | shared_lib/static_lib/shell/cctest | shell |
| **LIBICU** | Include libicu library | -DESCARGOT_LIBICU_SUPPORT | ON/OFF | ON |
| **WASM** | Enable WebAssembly support | -DESCARGOT_WASM | ON/OFF | OFF |
| **CODE_CACHE** | Enable code cache | -DESCARGOT_CODE_CACHE | ON/OFF | OFF |
| **TCO** | Enable tail call optimization | -DESCARGOT_TCO | ON/OFF | OFF |
| **THREADING** | Enable threading features (e.g. Atomics, SharedArrayBuffer) | -DESCARGOT_THREADING | ON/OFF | ON |
| **TLS_ADDRESS_OFFSET** | Enable thread local storge access optimization(offset) | -DESCARGOT_TLS_ACCESS_BY_ADDRESS | ON/OFF | OFF |
| **TLS_PTHREAD_KEY** | Enable thread local storge access optimization(pthread_key) | -DESCARGOT_TLS_ACCESS_BY_PTHREAD_KEY | ON/OFF | OFF |
| **TEMPORAL** | Enable Temporal support | -ESCARGOT_TEMPORAL | ON/OFF | OFF |
| **SHADOWREALM** | Enable ShadowRealm support | -ESCARGOT_SHADOWREALM | ON/OFF | OFF |
| **SMALL_CONFIG** | Enable aggressive memory optimizations for tiny devices | -DESCARGOT_SMALL_CONFIG | ON/OFF | OFF |
| **TEST** | Enable additional features used only for testing | -DESCARGOT_TEST | ON/OFF | OFF |
| **DEBUGGER** | Enable Debug server | -DESCARGOT_DEBUGGER | ON/OFF | OFF |
### Linux
General build prerequisites:
```sh
sudo apt-get install autoconf automake cmake libtool libicu-dev ninja-build pkg-config
```
## Build Escargot
``` sh
git clone git@github.sec.samsung.net:lws/escargot.git
cd escargot
git submodule update --init third_party
cmake CMakeLists.txt -DESCARGOT_HOST=linux -DESCARGOT_ARCH=x64 -DESCARGOT_MODE=release -DESCARGOT_OUTPUT=bin
make -j
Prerequisites for x86-64-to-x86 compilation:
```sh
sudo apt-get install gcc-multilib g++-multilib
sudo apt-get install libicu-dev:i386
```
#### Build options
The following build options are supported when generating Makefile using cmake.
* -DESCARGOT_HOST=[ linux | tizen_obs ]<br>
Compile Escargot for either Linux or Tizen platform
* -DESCARGOT_ARCH=[ x64 | x86 | arm | i686 | aarch64 ]<br>
Compile Escargot for each architecture
* -DESCARGOT_MODE=[ debug | release ]<br>
Compile Escargot for either release or debug mode
* -DESCARGOT_OUTPUT=[ bin | shared_lib | static_lib ]<br>
Define target output type
## Testing
First, get benchmarks and tests
``` sh
git submodule update --init
Build Escargot:
```sh
git submodule update --init third_party # update submodules
cmake -DESCARGOT_MODE=release -DESCARGOT_OUTPUT=shell -GNinja
ninja
```
### Benchmarks
### macOS
General build prerequisites:
```sh
brew install autoconf automake cmake icu4c libtool ninja pkg-config
# add icu path to pkg_config_path (x64)
export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig:$PKG_CONFIG_PATH"
# add icu path to pkg_config_path (arm64)
export PKG_CONFIG_PATH="/opt/homebrew/opt/icu4c/lib/pkgconfig:$PKG_CONFIG_PATH"
```
Build Escargot:
```sh
git submodule update --init third_party # update submodules
cmake -DESCARGOT_MODE=release -DESCARGOT_OUTPUT=shell -GNinja
ninja
```
### Android
Build prerequisites on Ubuntu:
```sh
sudo apt install openjdk-17-jdk # require java 17
```
Build Escargot using gradle:
```sh
git submodule update --init third_party # update submodules
export ANDROID_SDK_ROOT=.... # set your android SDK root first
cd build/android/
./gradlew bundleReleaseAar # build escargot AAR
./gradlew bundleHostJar # bundle jar for host
./gradlew javadocJar # create java doc
./gradlew sourcesJar # create sources jar
./gradlew assembleDebug # build debug test shell
./gradlew :escargot:connectedDebugAndroidTest # run escargot-jni tests on android device
./gradlew :escargot:testDebugUnitTest # run escargot-jni tests on host
```
### Windows
Install VS2022 with cmake and ninja.
Open [ x86 Native Tools Command Prompt for VS 2022 | x64 Native Tools Command Prompt for VS 2022 ]
```sh
make run-sunspider-js # Sunspider
make run-octane # Octane
make run-v8-x64 # V8 for x64
make run-chakracore-x64 # Chakracore for x64
make run-test262 # test262
git submodule update --init third_party # update submodules
CMake -G "Visual Studio 17 2022" -DCMAKE_SYSTEM_NAME=[ Windows | WindowsStore ] -DCMAKE_SYSTEM_VERSION:STRING="10.0" -DCMAKE_SYSTEM_PROCESSOR=[ x86 | x64 ] -DCMAKE_GENERATOR_PLATFORM=[ Win32 | x64 ],version=10.0.18362.0 -DESCARGOT_ARCH=[ x86 | x64 ] -DESCARGOT_MODE=release -Bout -DESCARGOT_HOST=windows -DESCARGOT_OUTPUT=shell -DESCARGOT_LIBICU_SUPPORT=ON -DESCARGOT_THREADING=ON
cd out
msbuild ESCARGOT.sln /property:Configuration=Release /p:platform=[ Win32 | x64 ]
```
## Misc.
## Debugger
### CI Infrastructure
Make sure Escargot is built with the `-DESCARGOT_DEBUGGER=1` flag (off by default) enabled;
then start Escargot with the `--start-debug-server` option.
http://10.113.64.74:8080/job/escargot2_daily_measure/
### 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.
| Benchmark | flag |
| --- | --- |
| SunSpider 1.0.2 | `sunspider` |
| [Octane 2.0](https://github.com/chromium/octane.git) | `octane` |
| [test262](https://github.com/tc39/test262.git) | `test262` |
| [Web Tooling Benchmark](https://github.com/v8/web-tooling-benchmark) | `web-tooling-benchmark` |
| SpiderMonkey (vendor-made) | `spidermonkey` |
| ChakraCore (vendor-made) | `chakracore` |
| V8 (vendor-made) | `v8` |
Run each benchmark separately or all together as shown below:
```sh
tools/run-tests.py --engine=./out/linux/x64/release/escargot web-tooling-benchmark
tools/run-tests.py --engine=./out/linux/x64/release/escargot spidermonkey test262 v8
```
## Contributing 💡
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.

1
RELEASE_VERSION Normal file
View file

@ -0,0 +1 @@
v4.3.0

View file

@ -1,163 +0,0 @@
#######################################################
# common flags
#######################################################
ESCARGOT_CXXFLAGS_COMMON += -DESCARGOT
ESCARGOT_CXXFLAGS_COMMON += -std=c++0x -g3
ESCARGOT_CXXFLAGS_COMMON += -fno-math-errno -I$(ESCARGOT_ROOT)/src/
ESCARGOT_CXXFLAGS_COMMON += -fdata-sections -ffunction-sections
ESCARGOT_CXXFLAGS_COMMON += -frounding-math -fsignaling-nans
ESCARGOT_CXXFLAGS_COMMON += -fno-omit-frame-pointer
ESCARGOT_CXXFLAGS_COMMON += -fvisibility=hidden
ESCARGOT_CXXFLAGS_COMMON += -Wno-unused-but-set-variable -Wno-unused-but-set-parameter -Wno-unused-parameter
ESCARGOT_CXXFLAGS_COMMON += -Wno-type-limits -Wno-unused-result -Wno-unused-variable -Wno-invalid-offsetof
ESCARGOT_CXXFLAGS_COMMON += -Wno-deprecated-declarations
ESCARGOT_CXXFLAGS_COMMON += -Wno-implicit-fallthrough
ESCARGOT_CXXFLAGS_COMMON += -DESCARGOT_ENABLE_TYPEDARRAY
ESCARGOT_CXXFLAGS_COMMON += -DESCARGOT_ENABLE_PROMISE
#ESCARGOT_CXXFLAGS_COMMON += -DPROFILE_MASSIF
#ESCARGOT_CXXFLAGS_COMMON += -DPROFILE_BDWGC
ESCARGOT_LDFLAGS_COMMON = -fvisibility=hidden
ifeq ($(HOST), linux)
ESCARGOT_CXXFLAGS_COMMON += -fno-rtti
ESCARGOT_LDFLAGS_COMMON += -lpthread
ESCARGOT_LDFLAGS_COMMON += -lrt
else ifeq ($(HOST), tizen_obs)
ESCARGOT_LDFLAGS_COMMON += -lpthread
ESCARGOT_LDFLAGS_COMMON += -lrt
else ifneq (,$(findstring tizen_,$(HOST)))
ESCARGOT_LDFLAGS_COMMON += -lpthread
ESCARGOT_LDFLAGS_COMMON += -lrt
else ifeq ($(HOST), android)
ESCARGOT_CXXFLAGS_COMMON += -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DANDROID=1
ESCARGOT_LDFLAGS_COMMON += -fPIE -pie -march=armv7-a -Wl,--fix-cortex-a8 -llog
ifeq ($(OUTPUT), shared_lib)
ESCARGOT_LDFLAGS_COMMON += -shared
endif
ifeq ($(REACT_NATIVE), 1)
ESCARGOT_CXXFLAGS_COMMON += -UESCARGOT_ENABLE_PROMISE
ESCARGOT_CXXFLAGS_COMMON += -frtti -std=c++11
endif
endif
#######################################################
# flags for $(HOST) : linux / tizen*
#######################################################
ESCARGOT_CXXFLAGS_TIZEN += -DESCARGOT_SMALL_CONFIG=1 -DESCARGOT_TIZEN
#######################################################
# flags for $(ARCH) : x64/x86/arm
#######################################################
ESCARGOT_CXXFLAGS_X64 += -DESCARGOT_64=1
ESCARGOT_LDFLAGS_X64 =
# https://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/i386-and-x86_002d64-Options.html
ESCARGOT_CXXFLAGS_X86 += -DESCARGOT_32=1
ifneq ($(HOST),tizen_obs)
ESCARGOT_CXXFLAGS_X86 += -m32 -mfpmath=sse -msse -msse2
ESCARGOT_LDFLAGS_X86 += -m32
endif
ESCARGOT_CXXFLAGS_ARM += -DESCARGOT_32=1
ESCARGOT_CXXFLAGS_AARCH64 += -DESCARGOT_64=1
ifneq ($(HOST),tizen_obs)
ESCARGOT_CXXFLAGS_ARM += -march=armv7-a -mthumb
ESCARGOT_LDFLAGS_ARM =
endif
#######################################################
#######################################################
# flags for $(MODE) : debug/release
#######################################################
ESCARGOT_CXXFLAGS_DEBUG += -O0 -D_GLIBCXX_DEBUG -Wall -Wextra -Werror
ESCARGOT_CXXFLAGS_RELEASE += -O2 -DNDEBUG -fno-stack-protector
ifneq (,$(findstring tizen,$(HOST)))
ESCARGOT_CXXFLAGS_RELEASE += -Os -finline-limit=64
ifeq ($(HOST),tizen_obs)
ESCARGOT_CXXFLAGS_DEBUG += -O1 # _FORTIFY_SOURCE requires compiling with optimization
endif
endif
#######################################################
# flags for $(OUTPUT) : bin/shared_lib/static_lib
#######################################################
ESCARGOT_CXXFLAGS_BIN += -DESCARGOT_STANDALONE
ESCARGOT_LDFLAGS_BIN += -Wl,--gc-sections
ESCARGOT_CXXFLAGS_SHAREDLIB += -fPIC
ESCARGOT_LDFLAGS_SHAREDLIB += -ldl
ESCARGOT_CXXFLAGS_STATICLIB += -fPIC
ESCARGOT_LDFLAGS_STATICLIB += -Wl,--gc-sections
#######################################################
# flags for LTO
#######################################################
ESCARGOT_CXXFLAGS_LTO += -flto -ffat-lto-objects
ESCARGOT_LDFLAGS_LTO += -flto
#######################################################
# flags for TEST
#######################################################
ESCARGOT_CXXFLAGS_VENDORTEST += -DESCARGOT_ENABLE_VENDORTEST
#######################################################
# flags for $(THIRD_PARTY)
#######################################################
# icu
ifeq ($(HOST), linux)
ESCARGOT_CXXFLAGS_COMMON += -DENABLE_ICU -DENABLE_INTL
ifeq ($(ARCH), x64)
ESCARGOT_CXXFLAGS_THIRD_PARTY += $(shell pkg-config --cflags icu-uc icu-i18n)
ESCARGOT_LDFLAGS_THIRD_PARTY += $(shell pkg-config --libs icu-uc icu-i18n)
else ifeq ($(ARCH), x86)
ESCARGOT_CXXFLAGS_THIRD_PARTY += $(shell pkg-config --cflags icu-uc icu-i18n)
ESCARGOT_LDFLAGS_THIRD_PARTY += $(shell pkg-config --libs icu-uc icu-i18n)
# ESCARGOT_CXXFLAGS_THIRD_PARTY += -I$(ESCARGOT_ROOT)/deps/x86-linux/include
# ESCARGOT_LDFLAGS_THIRD_PARTY += -Ldeps/x86-linux/lib -Wl,-rpath='deps/x86-linux/lib/' -Wl,-rpath,'$$ORIGIN/deps/x86-linux/lib/'
# ESCARGOT_LDFLAGS_THIRD_PARTY += -licuio -licui18n -licuuc -licudata
endif
else ifeq ($(HOST), tizen_obs)
ESCARGOT_CXXFLAGS_COMMON += -DENABLE_ICU -DENABLE_INTL
ESCARGOT_CXXFLAGS_THIRD_PARTY += $(shell pkg-config --cflags icu-uc icu-i18n)
ESCARGOT_LDFLAGS_THIRD_PARTY += $(shell pkg-config --libs icu-uc icu-i18n)
else ifneq (,$(findstring tizen_,$(HOST)))
ESCARGOT_CXXFLAGS_COMMON += -DENABLE_ICU -DENABLE_INTL
ifeq ($(ARCH), arm)
ESCARGOT_CXXFLAGS_THIRD_PARTY += -I$(ESCARGOT_ROOT)/deps/tizen/include
ESCARGOT_LDFLAGS_THIRD_PARTY += -Ldeps/tizen/lib/tizen-wearable-$(VERSION)-target-arm
ESCARGOT_LDFLAGS_THIRD_PARTY += -licuio -licui18n -licuuc -licudata
else ifeq ($(ARCH), i386)
ESCARGOT_CXXFLAGS_THIRD_PARTY += -I$(ESCARGOT_ROOT)/deps/tizen/include
ESCARGOT_LDFLAGS_THIRD_PARTY += -Ldeps/tizen/lib/tizen-wearable-$(VERSION)-emulator-x86
ESCARGOT_LDFLAGS_THIRD_PARTY += -licuio -licui18n -licuuc -licudata
endif
endif
# bdwgc
ESCARGOT_CXXFLAGS_THIRD_PARTY += -I$(ESCARGOT_ROOT)/third_party/GCutil/bdwgc/include/
ifeq ($(MODE), debug)
ESCARGOT_CXXFLAGS_THIRD_PARTY += -DGC_DEBUG
endif
# checked arithmetic
ESCARGOT_CXXFLAGS_THIRD_PARTY += -I$(ESCARGOT_ROOT)/third_party/checked_arithmetic/
# v8's fast-dtoa
ESCARGOT_CXXFLAGS_THIRD_PARTY += -I$(ESCARGOT_ROOT)/third_party/double_conversion/
# rapidjson
ESCARGOT_CXXFLAGS_THIRD_PARTY += -I$(ESCARGOT_ROOT)/third_party/rapidjson/include/
# yarr
ESCARGOT_CXXFLAGS_THIRD_PARTY += -I$(ESCARGOT_ROOT)/third_party/yarr/
# GCutil
ESCARGOT_CXXFLAGS_THIRD_PARTY += -I$(ESCARGOT_ROOT)/third_party/GCutil/

View file

@ -1,163 +0,0 @@
#######################################################
# common flags
#######################################################
ESCARGOT_CXXFLAGS_COMMON += -DESCARGOT
ESCARGOT_CXXFLAGS_COMMON += -std=c++0x -g3
ESCARGOT_CXXFLAGS_COMMON += -fno-math-errno -I$(ESCARGOT_ROOT)/src/
ESCARGOT_CXXFLAGS_COMMON += -fdata-sections -ffunction-sections
# ESCARGOT_CXXFLAGS_COMMON += -frounding-math -fsignaling-nans
ESCARGOT_CXXFLAGS_COMMON += -fno-fast-math -fno-unsafe-math-optimizations -fdenormal-fp-math=ieee
ESCARGOT_CXXFLAGS_COMMON += -fno-omit-frame-pointer
ESCARGOT_CXXFLAGS_COMMON += -fvisibility=hidden
ESCARGOT_CXXFLAGS_COMMON += -stdlib=libc++
ESCARGOT_CXXFLAGS_COMMON += -Wno-parentheses-equality -Wno-unused-parameter -Wno-dynamic-class-memaccess -Wno-deprecated-register -Wno-expansion-to-defined -Wno-return-type
ESCARGOT_CXXFLAGS_COMMON += -Wno-type-limits -Wno-unused-result -Wno-unused-variable -Wno-invalid-offsetof
ESCARGOT_CXXFLAGS_COMMON += -Wno-deprecated-declarations
ESCARGOT_CXXFLAGS_COMMON += -DESCARGOT_ENABLE_TYPEDARRAY
ESCARGOT_CXXFLAGS_COMMON += -DESCARGOT_ENABLE_PROMISE
#ESCARGOT_CXXFLAGS_COMMON += -DPROFILE_MASSIF
#ESCARGOT_CXXFLAGS_COMMON += -DPROFILE_BDWGC
ESCARGOT_LDFLAGS_COMMON = -fvisibility=hidden -stdlib=libc++
ifeq ($(HOST), linux)
ESCARGOT_CXXFLAGS_COMMON += -fno-rtti
ESCARGOT_LDFLAGS_COMMON += -lpthread
ESCARGOT_LDFLAGS_COMMON += -lrt
else ifeq ($(HOST), tizen_obs)
ESCARGOT_LDFLAGS_COMMON += -lpthread
ESCARGOT_LDFLAGS_COMMON += -lrt
else ifneq (,$(findstring tizen_,$(HOST)))
ESCARGOT_LDFLAGS_COMMON += -lpthread
ESCARGOT_LDFLAGS_COMMON += -lrt
else ifeq ($(HOST), android)
ESCARGOT_CXXFLAGS_COMMON += -fPIE -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -DANDROID=1
ESCARGOT_LDFLAGS_COMMON += -fPIE -pie -march=armv7-a -Wl,--fix-cortex-a8 -llog
ifeq ($(OUTPUT), shared_lib)
ESCARGOT_LDFLAGS_COMMON += -shared
endif
ifeq ($(REACT_NATIVE), 1)
ESCARGOT_CXXFLAGS_COMMON += -UESCARGOT_ENABLE_PROMISE
ESCARGOT_CXXFLAGS_COMMON += -frtti -std=c++11
endif
endif
#######################################################
# flags for $(HOST) : linux / tizen*
#######################################################
ESCARGOT_CXXFLAGS_TIZEN += -DESCARGOT_SMALL_CONFIG=1 -DESCARGOT_TIZEN
#######################################################
# flags for $(ARCH) : x64/x86/arm
#######################################################
ESCARGOT_CXXFLAGS_X64 += -DESCARGOT_64=1
ESCARGOT_LDFLAGS_X64 =
# https://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/i386-and-x86_002d64-Options.html
ESCARGOT_CXXFLAGS_X86 += -DESCARGOT_32=1
ifneq ($(HOST),tizen_obs)
ESCARGOT_CXXFLAGS_X86 += -m32 -mfpmath=sse -msse -msse2
ESCARGOT_LDFLAGS_X86 += -m32
endif
ESCARGOT_CXXFLAGS_ARM += -DESCARGOT_32=1
ifneq ($(HOST),tizen_obs)
ESCARGOT_CXXFLAGS_ARM += -march=armv7-a -mthumb
ESCARGOT_LDFLAGS_ARM =
endif
#######################################################
#######################################################
# flags for $(MODE) : debug/release
#######################################################
ESCARGOT_CXXFLAGS_DEBUG += -O0 -D_GLIBCXX_DEBUG -Wall -Wextra -Werror
ESCARGOT_CXXFLAGS_RELEASE += -O2 -DNDEBUG -fno-stack-protector
ifneq (,$(findstring tizen,$(HOST)))
ESCARGOT_CXXFLAGS_RELEASE += -Os -finline-limit=64
ifeq ($(HOST),tizen_obs)
ESCARGOT_CXXFLAGS_DEBUG += -O1 # _FORTIFY_SOURCE requires compiling with optimization
endif
endif
#######################################################
# flags for $(OUTPUT) : bin/shared_lib/static_lib
#######################################################
ESCARGOT_CXXFLAGS_BIN += -DESCARGOT_STANDALONE
ESCARGOT_LDFLAGS_BIN += -Wl,--gc-sections
ESCARGOT_CXXFLAGS_SHAREDLIB += -fPIC
ESCARGOT_LDFLAGS_SHAREDLIB += -ldl
ESCARGOT_CXXFLAGS_STATICLIB += -fPIC
ESCARGOT_LDFLAGS_STATICLIB += -Wl,--gc-sections
#######################################################
# flags for LTO
#######################################################
ESCARGOT_CXXFLAGS_LTO += -flto -ffat-lto-objects
ESCARGOT_LDFLAGS_LTO += -flto
#######################################################
# flags for TEST
#######################################################
ESCARGOT_CXXFLAGS_VENDORTEST += -DESCARGOT_ENABLE_VENDORTEST
#######################################################
# flags for $(THIRD_PARTY)
#######################################################
# icu
ifeq ($(HOST), linux)
ESCARGOT_CXXFLAGS_COMMON += -DENABLE_ICU -DENABLE_INTL
ifeq ($(ARCH), x64)
ESCARGOT_CXXFLAGS_THIRD_PARTY += $(shell pkg-config --cflags icu-uc icu-i18n)
ESCARGOT_LDFLAGS_THIRD_PARTY += $(shell pkg-config --libs icu-uc icu-i18n)
else ifeq ($(ARCH), x86)
ESCARGOT_CXXFLAGS_THIRD_PARTY += $(shell pkg-config --cflags icu-uc icu-i18n)
ESCARGOT_LDFLAGS_THIRD_PARTY += $(shell pkg-config --libs icu-uc icu-i18n)
# ESCARGOT_CXXFLAGS_THIRD_PARTY += -I$(ESCARGOT_ROOT)/deps/x86-linux/include
# ESCARGOT_LDFLAGS_THIRD_PARTY += -Ldeps/x86-linux/lib -Wl,-rpath='deps/x86-linux/lib/' -Wl,-rpath,'$$ORIGIN/deps/x86-linux/lib/'
# ESCARGOT_LDFLAGS_THIRD_PARTY += -licuio -licui18n -licuuc -licudata
endif
else ifeq ($(HOST), tizen_obs)
ESCARGOT_CXXFLAGS_COMMON += -DENABLE_ICU -DENABLE_INTL
ESCARGOT_CXXFLAGS_THIRD_PARTY += $(shell pkg-config --cflags icu-uc icu-i18n)
ESCARGOT_LDFLAGS_THIRD_PARTY += $(shell pkg-config --libs icu-uc icu-i18n)
else ifneq (,$(findstring tizen_,$(HOST)))
ESCARGOT_CXXFLAGS_COMMON += -DENABLE_ICU -DENABLE_INTL
ifeq ($(ARCH), arm)
ESCARGOT_CXXFLAGS_THIRD_PARTY += -I$(ESCARGOT_ROOT)/deps/tizen/include
ESCARGOT_LDFLAGS_THIRD_PARTY += -Ldeps/tizen/lib/tizen-wearable-$(VERSION)-target-arm
ESCARGOT_LDFLAGS_THIRD_PARTY += -licuio -licui18n -licuuc -licudata
else ifeq ($(ARCH), i386)
ESCARGOT_CXXFLAGS_THIRD_PARTY += -I$(ESCARGOT_ROOT)/deps/tizen/include
ESCARGOT_LDFLAGS_THIRD_PARTY += -Ldeps/tizen/lib/tizen-wearable-$(VERSION)-emulator-x86
ESCARGOT_LDFLAGS_THIRD_PARTY += -licuio -licui18n -licuuc -licudata
endif
endif
# bdwgc
ESCARGOT_CXXFLAGS_THIRD_PARTY += -I$(ESCARGOT_ROOT)/third_party/GCutil/bdwgc/include/
ifeq ($(MODE), debug)
ESCARGOT_CXXFLAGS_THIRD_PARTY += -DGC_DEBUG
endif
# checked arithmetic
ESCARGOT_CXXFLAGS_THIRD_PARTY += -I$(ESCARGOT_ROOT)/third_party/checked_arithmetic/
# v8's fast-dtoa
ESCARGOT_CXXFLAGS_THIRD_PARTY += -I$(ESCARGOT_ROOT)/third_party/double_conversion/
# rapidjson
ESCARGOT_CXXFLAGS_THIRD_PARTY += -I$(ESCARGOT_ROOT)/third_party/rapidjson/include/
# yarr
ESCARGOT_CXXFLAGS_THIRD_PARTY += -I$(ESCARGOT_ROOT)/third_party/yarr/
# GCutil
ESCARGOT_CXXFLAGS_THIRD_PARTY += -I$(ESCARGOT_ROOT)/third_party/GCutil/

View file

@ -1,16 +0,0 @@
## build script for test/cctest/*
SRC_TC = $(foreach dir, test/cctest, $(wildcard $(dir)/*.cpp))
EXE_TC = $(SRC_TC:%.cpp= $(OUTDIR)/%.exe)
LINK_LIBS += -L$(OUTDIR) -Wl,-rpath=$(OUTDIR) -lescargot $(ESCARGOT_LDFLAGS_THIRD_PARTY)
x86.interpreter.debug.shared.cctest: x86.interpreter.debug.shared $(EXE_TC)
x86.interpreter.release.shared.cctest: x86.interpreter.release.shared $(EXE_TC)
x64.interpreter.debug.shared.cctest: x64.interpreter.debug.shared $(EXE_TC)
x64.interpreter.release.shared.cctest: x64.interpreter.release.shared $(EXE_TC)
x64.interpreter.debug.shared.cctest.run: x64.interpreter.debug.shared.cctest
for f in $(EXE_TC); do LD_LIBRARY_PATH=. $$f; done;
$(OUTDIR)/%.exe: %.cpp $(DEPENDENCY_MAKEFILE) $(OUTDIR)/libescargot.so install_header_to_include
mkdir -p $(OUTDIR)/test/cctest
$(QUIET) echo "[CCTEST] " $@
$(CXX) -I$(ESCARGOT_ROOT)/include $(CXXFLAGS) $(DFLAGS) $(IFLAGS) $(LDFLAGS) $< -o $@ $(LINK_LIBS)

View file

@ -1,143 +0,0 @@
# TODO this list should be maintained in a better way
OPT_MASTER_PROMISE=built-ins/Promise
OPT_MASTER_ARRAYBUFFER=#built-ins/ArrayBuffer
OPT_MASTER_DATAVIEW=#built-ins/DataView
OPT_MASTER_TYPEDARRAY=built-ins/TypedArray/prototype/set built-ins/TypedArray/prototype/indexOf built-ins/TypedArray/prototype/lastIndexOf #built-ins/TypedArray built-ins/TypedArrays
check:
make tidy-update
make x86.interpreter.release -j$(NPROCS)
# make run-sunspider | tee out/sunspider_result
make run-test262
# make run-test262-master OPT="$(OPT_MASTER_PROMISE) $(OPT_MASTER_ARRAYBUFFER) $(OPT_MASTER_DATAVIEW) $(OPT_MASTER_TYPEDARRAY)"
make run-spidermonkey-full
make run-internal-test
tidy-install:
apt-get install clang-format-3.8
tidy:
python tools/check_tidy.py
tidy-update:
python tools/check_tidy.py update
# Targets : benchmarks
run-sunspider:
cd test/vendortest/SunSpider/; \
./sunspider --shell=../../../escargot --suite=sunspider-1.0.2
run-sunspider-js:
./escargot test/vendortest/SunSpider/tests/sunspider-1.0.2/*.js
run-octane:
cd test/octane/; \
../../escargot run.js | tail -1 > ../../out/octane_result; \
if ! cat ../../out/octane_result | grep -c 'Score' > /dev/null; then exit 1; fi
# Targets : Regression test
run-internal-test:
cp ./test/vendortest/driver/internal-test-cases.txt ./test/vendortest/internal/internal-test-cases.txt ; \
cp ./test/vendortest/driver/internal-test-driver.py ./test/vendortest/internal/driver.py ; \
cd ./test/vendortest/internal/ ; \
python ./driver.py ../../../escargot internal-test-cases.txt \
cd -
run-test262:
cp excludelist.orig.xml test/test262/test/config/excludelist.xml
cp test262.py test/test262/tools/packaging/test262.py
cd test/test262/; \
TZ="US/Pacific" python tools/packaging/test262.py --command ../../escargot $(OPT) --full-summary
run-test262-master:
cp test/test262-harness-py-excludelist.xml test/test262-harness-py/excludelist.xml
cp test/test262-harness-py-test262.py ./test/test262-harness-py/src/test262.py
python ./test/test262-harness-py/src/test262.py --command ./escargot --tests=test/test262-master $(OPT) --full-summary
run-spidermonkey:
cp /usr/local/lib/node_modules/vendortest/node_modules/ . -rf
nodejs node_modules/.bin/babel test/vendortest/SpiderMonkey/ecma_6/Promise --out-dir test/vendortest/SpiderMonkey/ecma_6/Promise
rm test/vendortest/SpiderMonkey/shell.js
ln -s `pwd`/test/vendortest/driver/spidermonkey.shell.js test/vendortest/SpiderMonkey/shell.js
rm test/vendortest/SpiderMonkey/js1_8_1/jit/shell.js
ln -s `pwd`/test/vendortest/driver/spidermonkey.js1_8_1.jit.shell.js test/vendortest/SpiderMonkey/js1_8_1/jit/shell.js
rm test/vendortest/SpiderMonkey/ecma_6/shell.js
ln -s `pwd`/test/vendortest/driver/spidermonkey.ecma_6.shell.js test/vendortest/SpiderMonkey/ecma_6/shell.js
rm test/vendortest/SpiderMonkey/ecma_6/TypedArray/shell.js
ln -s `pwd`/test/vendortest/driver/spidermonkey.ecma_6.TypedArray.shell.js test/vendortest/SpiderMonkey/ecma_6/TypedArray/shell.js
rm test/vendortest/SpiderMonkey/ecma_6/Math/shell.js
ln -s `pwd`/test/vendortest/driver/spidermonkey.ecma_6.Math.shell.js test/vendortest/SpiderMonkey/ecma_6/Math/shell.js
$(eval BIN_ARCH:=$(shell [[ "$(shell file escargot)" == *"32-bit"* ]] && echo "x86" || echo "x86_64"))
(LOCALE="en_US" ./test/vendortest/SpiderMonkey/jstests.py -s --xul-info=$(BIN_ARCH)-gcc3:Linux:false \
--exclude-file=./test/vendortest/driver/spidermonkey.excludelist.txt ./escargot \
--output-file=./test/vendortest/driver/spidermonkey.$(BIN_ARCH).log.txt \
--failure-file=../../../test/vendortest/driver/spidermonkey.$(BIN_ARCH).gen.txt \
ecma/ ecma_2/ ecma_3/ ecma_3_1/ ecma_5/ ecma_6/Promise ecma_6/TypedArray ecma_6/ArrayBuffer ecma_6/Number ecma_6/Math \
js1_1/ js1_2/ js1_3/ js1_4/ js1_5/ js1_6/ js1_7/ js1_8/ js1_8_1/ js1_8_5/ shell/ supporting/ ) || (echo done)
sort test/vendortest/driver/spidermonkey.$(BIN_ARCH).orig.txt -o test/vendortest/driver/spidermonkey.$(BIN_ARCH).orig.sort.txt
sort test/vendortest/driver/spidermonkey.$(BIN_ARCH).gen.txt -o test/vendortest/driver/spidermonkey.$(BIN_ARCH).gen.sort.txt
diff test/vendortest/driver/spidermonkey.$(BIN_ARCH).orig.sort.txt test/vendortest/driver/spidermonkey.$(BIN_ARCH).gen.sort.txt
run-jsc-stress:
$(eval BIN_ARCH:=$(shell [[ "$(shell file escargot)" == *"32-bit"* ]] && echo "x86" || echo "x86_64"))
PYTHONPATH=. ./test/vendortest/driver/driver.py -s stress -a $(BIN_ARCH);
#run-jsc-mozilla:
# cd test/JavaScriptCore/mozilla/; \
perl jsDriver.pl -e escargot -s ../../../escargot
run-jetstream:
cp test/vendortest/driver/jetstream/jetstream.CDjsSetup.js test/vendortest/JetStream-1.1/CDjsSetup.js
cp test/vendortest/driver/jetstream/jetstream.OctaneSetup.js test/vendortest/JetStream-1.1/OctaneSetup.js
cp test/vendortest/driver/jetstream/jetstream.Octane2Setup.js test/vendortest/JetStream-1.1/Octane2Setup.js
cp test/vendortest/driver/jetstream/jetstream.SimpleSetup.js test/vendortest/JetStream-1.1/SimpleSetup.js
cp test/vendortest/driver/jetstream/jetstream.SunSpiderSetup.js test/vendortest/JetStream-1.1/SunSpiderSetup.js
cp test/vendortest/driver/jetstream/jetstream.cdjs.util.js test/vendortest/JetStream-1.1/cdjs/util.js
cp test/vendortest/driver/jetstream/jetstream.runOnePlan.js test/vendortest/JetStream-1.1/runOnePlan.js
cp test/vendortest/driver/jetstream/jetstream.run.sh test/vendortest/JetStream-1.1/run.sh
cd test/vendortest/JetStream-1.1/; \
./run.sh ../../../escargot $(TARGET_TEST); \
cd -; \
python test/vendortest/driver/jetstream/parsingResults.py test/vendortest/driver/jetstream/jetstream-result-raw.res $(TARGET_TEST);
run-jetstream-only-simple:
make run-jetstream TARGET_TEST="simple"
if cat test/vendortest/driver/jetstream/jetstream-result-raw.res | grep -c 'NaN' > /dev/null; then exit 1; fi
run-jetstream-only-cdjs:
make run-jetstream TARGET_TEST="cdjs"
if cat test/vendortest/driver/jetstream/jetstream-result-raw.res | grep -c 'NaN' > /dev/null; then exit 1; fi
run-jetstream-only-sunspider:
make run-jetstream TARGET_TEST="sunspider"
run-jetstream-only-octane:
make run-jetstream TARGET_TEST="octane"
run-chakracore:
cp test/vendortest/driver/chakracore/chakracore.run.sh test/vendortest/ChakraCore/run.sh
cp test/vendortest/driver/chakracore/chakracore.include.js test/vendortest/ChakraCore/include.js
cp test/vendortest/driver/chakracore/chakracore.rlexedirs.xml test/vendortest/ChakraCore/rlexedirs.xml
for i in test/vendortest/driver/chakracore/*.rlexe.xml; do dir=`echo $$i | cut -d'/' -f5 | cut -d'.' -f1`; \
echo "cp test/vendortest/driver/chakracore/$$dir.rlexe.xml test/vendortest/ChakraCore/$$dir/rlexe.xml"; \
cp test/vendortest/driver/chakracore/$$dir.rlexe.xml test/vendortest/ChakraCore/$$dir/rlexe.xml; done
echo "WScript.Echo('PASS');" >> test/vendortest/ChakraCore/DynamicCode/eval-nativecodedata.js
echo "WScript.Echo('PASS');" >> test/vendortest/ChakraCore/utf8/unicode_digit_as_identifier_should_work.js
$(eval BIN_ARCH:=$(shell [[ "$(shell file escargot)" == *"32-bit"* ]] && echo "x86" || echo "x86_64"))
test/vendortest/ChakraCore/run.sh ./escargot | tee test/vendortest/driver/chakracore.$(BIN_ARCH).gen.txt; \
diff test/vendortest/driver/chakracore.$(BIN_ARCH).orig.txt test/vendortest/driver/chakracore.$(BIN_ARCH).gen.txt
run-v8:
cp test/vendortest/driver/v8/v8.mjsunit.status test/vendortest/v8/test/mjsunit/mjsunit.status
cp test/vendortest/driver/v8/v8.mjsunit.js test/vendortest/v8/test/mjsunit/mjsunit.js
cp test/vendortest/driver/v8/v8.run-tests.py test/vendortest/v8/tools/run-tests.py
cp test/vendortest/driver/v8/v8.testsuite.py test/vendortest/v8/tools/testrunner/local/testsuite.py
cp test/vendortest/driver/v8/v8.execution.py test/vendortest/v8/tools/testrunner/local/execution.py
cp test/vendortest/driver/v8/v8.progress.py test/vendortest/v8/tools/testrunner/local/progress.py
$(eval ARCH:=$(shell [[ "$(shell file escargot)" == *"32-bit"* ]] && echo "x32" || echo "x64"))
./test/vendortest/v8/tools/run-tests.py --quickcheck --no-presubmit --no-variants --arch-and-mode=$(ARCH).release --shell-dir ../../../ --escargot --report -p verbose --no-sorting mjsunit | tee test/vendortest/driver/v8.$(ARCH).mjsunit.gen.txt; \
diff test/vendortest/driver/v8.$(ARCH).mjsunit.orig.txt test/vendortest/driver/v8.$(ARCH).mjsunit.gen.txt

View file

@ -1,63 +0,0 @@
ifeq ($(HOST), linux)
CC = gcc
CXX = g++
ARFLAGS =
else ifeq ($(HOST), android)
COMPILER_PREFIX=arm-linux-androideabi
CC = $(ANDROID_NDK_STANDALONE)/bin/$(COMPILER_PREFIX)-gcc
CXX = $(ANDROID_NDK_STANDALONE)/bin/$(COMPILER_PREFIX)-g++
LINK = $(ANDROID_NDK_STANDALONE)/bin/$(COMPILER_PREFIX)-g++
LD = $(ANDROID_NDK_STANDALONE)/bin/$(COMPILER_PREFIX)-ld
AR = $(ANDROID_NDK_STANDALONE)/bin/$(COMPILER_PREFIX)-ar
CXXFLAGS += --sysroot=$(ANDROID_NDK_STANDALONE)/sysroot
LDFLAGS += --sysroot=$(ANDROID_NDK_STANDALONE)/sysroot
ARFLAGS =
else ifeq ($(HOST), tizen_obs)
CC=gcc
CXX=g++
CXXFLAGS += $(shell pkg-config --cflags dlog)
LDFLAGS += $(shell pkg-config --libs dlog)
ifeq ($(LTO), 1)
ARFLAGS=--plugin=/usr/lib/bfd-plugins/liblto_plugin.so
else
ARFLAGS=
endif
else ifneq (,$(findstring tizen,$(HOST)))
ifndef TIZEN_SDK_HOME
$(error TIZEN_SDK_HOME must be set)
endif
ifneq (,$(findstring mobile,$(HOST)))
ifeq ($(ARCH), arm)
TIZEN_SYSROOT=$(TIZEN_SDK_HOME)/platforms/tizen-$(VERSION)/mobile/rootstraps/mobile-$(VERSION)-device.core
else ifeq ($(ARCH), i386)
TIZEN_SYSROOT=$(TIZEN_SDK_HOME)/platforms/tizen-$(VERSION)/mobile/rootstraps/mobile-$(VERSION)-emulator.core
endif
else ifneq (,$(findstring wearable,$(HOST)))
ifeq ($(ARCH), arm)
TIZEN_SYSROOT=$(TIZEN_SDK_HOME)/platforms/tizen-$(VERSION)/wearable/rootstraps/wearable-$(VERSION)-device.core
else ifeq ($(ARCH), i386)
TIZEN_SYSROOT=$(TIZEN_SDK_HOME)/platforms/tizen-$(VERSION)/wearable/rootstraps/wearable-$(VERSION)-emulator.core
endif
endif
COMPILER_PREFIX=$(ARCH)-linux-gnueabi
CC = $(TIZEN_SDK_HOME)/tools/$(COMPILER_PREFIX)-gcc-4.6/bin/$(COMPILER_PREFIX)-gcc
CXX = $(TIZEN_SDK_HOME)/tools/$(COMPILER_PREFIX)-gcc-4.6/bin/$(COMPILER_PREFIX)-g++
LINK = $(TIZEN_SDK_HOME)/tools/$(COMPILER_PREFIX)-gcc-4.6/bin/$(COMPILER_PREFIX)-g++
LD = $(TIZEN_SDK_HOME)/tools/$(COMPILER_PREFIX)-gcc-4.6/bin/$(COMPILER_PREFIX)-ld
ifeq ($(LTO), 1)
AR = $(TIZEN_SDK_HOME)/tools/$(COMPILER_PREFIX)-gcc-4.6/bin/$(COMPILER_PREFIX)-gcc-ar
else
AR = $(TIZEN_SDK_HOME)/tools/$(COMPILER_PREFIX)-gcc-4.6/bin/$(COMPILER_PREFIX)-ar
endif
CXXFLAGS += --sysroot=$(TIZEN_SYSROOT)
LDFLAGS += --sysroot=$(TIZEN_SYSROOT)
ifeq ($(LTO), 1)
ARFLAGS = --plugin=$(TIZEN_SDK_HOME)/tools/$(COMPILER_PREFIX)-gcc-4.6/libexec/gcc/$(COMPILER_PREFIX)/4.6.4/liblto_plugin.so
else
ARFLAGS =
endif
endif

View file

@ -1,63 +0,0 @@
ifeq ($(HOST), linux)
CC = clang
CXX = clang++
ARFLAGS =
else ifeq ($(HOST), android)
COMPILER_PREFIX=arm-linux-androideabi
CC = $(ANDROID_NDK_STANDALONE)/bin/$(COMPILER_PREFIX)-gcc
CXX = $(ANDROID_NDK_STANDALONE)/bin/$(COMPILER_PREFIX)-g++
LINK = $(ANDROID_NDK_STANDALONE)/bin/$(COMPILER_PREFIX)-g++
LD = $(ANDROID_NDK_STANDALONE)/bin/$(COMPILER_PREFIX)-ld
AR = $(ANDROID_NDK_STANDALONE)/bin/$(COMPILER_PREFIX)-ar
CXXFLAGS += --sysroot=$(ANDROID_NDK_STANDALONE)/sysroot
LDFLAGS += --sysroot=$(ANDROID_NDK_STANDALONE)/sysroot
ARFLAGS =
else ifeq ($(HOST), tizen_obs)
CC=gcc
CXX=g++
CXXFLAGS += $(shell pkg-config --cflags dlog)
LDFLAGS += $(shell pkg-config --libs dlog)
ifeq ($(LTO), 1)
ARFLAGS=--plugin=/usr/lib/bfd-plugins/liblto_plugin.so
else
ARFLAGS=
endif
else ifneq (,$(findstring tizen,$(HOST)))
ifndef TIZEN_SDK_HOME
$(error TIZEN_SDK_HOME must be set)
endif
ifneq (,$(findstring mobile,$(HOST)))
ifeq ($(ARCH), arm)
TIZEN_SYSROOT=$(TIZEN_SDK_HOME)/platforms/tizen-$(VERSION)/mobile/rootstraps/mobile-$(VERSION)-device.core
else ifeq ($(ARCH), i386)
TIZEN_SYSROOT=$(TIZEN_SDK_HOME)/platforms/tizen-$(VERSION)/mobile/rootstraps/mobile-$(VERSION)-emulator.core
endif
else ifneq (,$(findstring wearable,$(HOST)))
ifeq ($(ARCH), arm)
TIZEN_SYSROOT=$(TIZEN_SDK_HOME)/platforms/tizen-$(VERSION)/wearable/rootstraps/wearable-$(VERSION)-device.core
else ifeq ($(ARCH), i386)
TIZEN_SYSROOT=$(TIZEN_SDK_HOME)/platforms/tizen-$(VERSION)/wearable/rootstraps/wearable-$(VERSION)-emulator.core
endif
endif
COMPILER_PREFIX=$(ARCH)-linux-gnueabi
CC = $(TIZEN_SDK_HOME)/tools/$(COMPILER_PREFIX)-gcc-4.6/bin/$(COMPILER_PREFIX)-gcc
CXX = $(TIZEN_SDK_HOME)/tools/$(COMPILER_PREFIX)-gcc-4.6/bin/$(COMPILER_PREFIX)-g++
LINK = $(TIZEN_SDK_HOME)/tools/$(COMPILER_PREFIX)-gcc-4.6/bin/$(COMPILER_PREFIX)-g++
LD = $(TIZEN_SDK_HOME)/tools/$(COMPILER_PREFIX)-gcc-4.6/bin/$(COMPILER_PREFIX)-ld
ifeq ($(LTO), 1)
AR = $(TIZEN_SDK_HOME)/tools/$(COMPILER_PREFIX)-gcc-4.6/bin/$(COMPILER_PREFIX)-gcc-ar
else
AR = $(TIZEN_SDK_HOME)/tools/$(COMPILER_PREFIX)-gcc-4.6/bin/$(COMPILER_PREFIX)-ar
endif
CXXFLAGS += --sysroot=$(TIZEN_SYSROOT)
LDFLAGS += --sysroot=$(TIZEN_SYSROOT)
ifeq ($(LTO), 1)
ARFLAGS = --plugin=$(TIZEN_SDK_HOME)/tools/$(COMPILER_PREFIX)-gcc-4.6/libexec/gcc/$(COMPILER_PREFIX)/4.6.4/liblto_plugin.so
else
ARFLAGS =
endif
endif

10
build/android/.gitignore vendored Normal file
View file

@ -0,0 +1,10 @@
*.iml
.gradle
/local.properties
/.idea/*
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties

3
build/android/.idea/.gitignore generated vendored Normal file
View file

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

1
build/android/.idea/.name generated Normal file
View file

@ -0,0 +1 @@
Escargot android

6
build/android/.idea/compiler.xml generated Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="21" />
</component>
</project>

20
build/android/.idea/gradle.xml generated Normal file
View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="CHOOSE_PER_TEST" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/escargot" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

10
build/android/.idea/misc.xml generated Normal file
View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

18
build/android/.idea/vcs.xml generated Normal file
View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
<mapping directory="$PROJECT_DIR$/../../test/kangax" vcs="Git" />
<mapping directory="$PROJECT_DIR$/../../test/octane" vcs="Git" />
<mapping directory="$PROJECT_DIR$/../../test/test262" vcs="Git" />
<mapping directory="$PROJECT_DIR$/../../test/vendortest" vcs="Git" />
<mapping directory="$PROJECT_DIR$/../../test/web-tooling-benchmark" vcs="Git" />
<mapping directory="$PROJECT_DIR$/../../third_party/GCutil" vcs="Git" />
<mapping directory="$PROJECT_DIR$/../../third_party/googletest" vcs="Git" />
<mapping directory="$PROJECT_DIR$/../../third_party/walrus" vcs="Git" />
<mapping directory="$PROJECT_DIR$/../../third_party/walrus/third_party/sljit" vcs="Git" />
<mapping directory="$PROJECT_DIR$/../../third_party/walrus/third_party/uvwasi" vcs="Git" />
<mapping directory="$PROJECT_DIR$/../../third_party/walrus/third_party/wasm-c-api" vcs="Git" />
<mapping directory="$PROJECT_DIR$/../../third_party/wasm/wabt" vcs="Git" />
</component>
</project>

1
build/android/app/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

View file

@ -0,0 +1,41 @@
plugins {
id 'com.android.application'
}
android {
namespace 'com.samsung.lwe.escargot.shell'
compileSdk 34
defaultConfig {
applicationId "com.samsung.lwe.escargot.shell"
minSdk 28
targetSdk 34
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
signingConfig signingConfigs.debug
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation project(path: ':escargot')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

21
build/android/app/proguard-rules.pro vendored Normal file
View file

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View file

@ -0,0 +1,26 @@
package com.samsung.lwe.escargot.shell;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.samsung.lwe.escargot.shell", appContext.getPackageName());
}
}

View file

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.EscargotAndroidTestShell"
tools:targetApi="31">
<profileable android:shell="true" />
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
</application>
</manifest>

View file

@ -0,0 +1,333 @@
package com.samsung.lwe.escargot.shell;
import androidx.appcompat.app.AppCompatActivity;
import android.content.res.AssetManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;
import com.samsung.lwe.escargot.Bridge;
import com.samsung.lwe.escargot.Context;
import com.samsung.lwe.escargot.Evaluator;
import com.samsung.lwe.escargot.Globals;
import com.samsung.lwe.escargot.JavaScriptArrayObject;
import com.samsung.lwe.escargot.JavaScriptJavaCallbackFunctionObject;
import com.samsung.lwe.escargot.JavaScriptString;
import com.samsung.lwe.escargot.JavaScriptValue;
import com.samsung.lwe.escargot.Memory;
import com.samsung.lwe.escargot.VMInstance;
import com.samsung.lwe.escargot.util.MultiThreadExecutor;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Optional;
public class MainActivity extends AppCompatActivity {
private void copyAssets() {
AssetManager assetManager = getAssets();
String[] files = null;
try {
files = assetManager.list("");
} catch (IOException e) {
Log.e("tag", "Failed to get asset file list.", e);
}
for(String filename : files) {
InputStream in = null;
OutputStream out = null;
try {
in = assetManager.open(filename);
File outFile = new File(getApplicationContext().getFilesDir(), filename);
out = new FileOutputStream(outFile);
copyFile(in, out);
in.close();
in = null;
out.flush();
out.close();
out = null;
} catch(IOException e) {
Log.e("tag", "Failed to copy asset file: " + filename, e);
}
}
Log.e("Escargot shell", getApplicationContext().getFilesDir().getAbsolutePath());
}
private void copyFile(InputStream in, OutputStream out) throws IOException {
byte[] buffer = new byte[1024];
int read;
while((read = in.read(buffer)) != -1){
out.write(buffer, 0, read);
}
}
String str = "";
private void run()
{
final String base = getApplicationContext().getFilesDir().getAbsolutePath() + "/";
new Thread(() -> {
Globals.initializeGlobals();
Memory.setGCFrequency(2);
VMInstance vm = VMInstance.create(Optional.empty(), Optional.empty());
Context context = Context.create(vm);
{
Context finalContext = context;
context.getGlobalObject().set(context, JavaScriptString.create("print"), JavaScriptJavaCallbackFunctionObject.create(context, "print", 1, false, new JavaScriptJavaCallbackFunctionObject.Callback() {
@Override
public Optional<JavaScriptValue> callback(Context context, JavaScriptValue javaScriptValue, JavaScriptValue[] javaScriptValues) {
StringBuffer sb = new StringBuffer();
sb.append(str);
sb.append('\n');
for (int i = 0; i < javaScriptValues.length; i ++) {
if (i > 0) {
System.out.print(" ");
sb.append(' ');
}
Optional<JavaScriptString> s = javaScriptValues[i].toString(finalContext);
if (s.isPresent()) {
String j = s.get().toJavaString();
System.out.print(j);
sb.append(j);
}
}
System.out.println();
str = sb.toString();
final String ff = str;
runOnUiThread(new Runnable() {
@Override
public void run() {
TextView tv = ((TextView)findViewById(R.id.output));
tv.setText(ff);
}
});
return Optional.empty();
}
}));
context.getGlobalObject().set(context, JavaScriptString.create("load"), JavaScriptJavaCallbackFunctionObject.create(context, "run", 1, false, new JavaScriptJavaCallbackFunctionObject.Callback() {
@Override
public Optional<JavaScriptValue> callback(Context context, JavaScriptValue javaScriptValue, JavaScriptValue[] javaScriptValues) {
Optional<JavaScriptString> s = javaScriptValues[0].toString(finalContext);
if (s.isPresent()) {
try {
byte[] chars = Files.readAllBytes(Paths.get(s.get().toJavaString()));
String fileContent = new String(chars);
return Evaluator.evalScript(finalContext, fileContent, s.get().toJavaString(), false);
}
catch (Exception ex) {
ex.printStackTrace();
return Optional.empty();
}
}
return Optional.empty();
}
}));
context.getGlobalObject().set(context, JavaScriptString.create("run"), JavaScriptJavaCallbackFunctionObject.create(context, "run", 1, false, new JavaScriptJavaCallbackFunctionObject.Callback() {
@Override
public Optional<JavaScriptValue> callback(Context context, JavaScriptValue javaScriptValue, JavaScriptValue[] javaScriptValues) {
long sm = System.currentTimeMillis();
Optional<JavaScriptString> s = javaScriptValues[0].toString(finalContext);
if (s.isPresent()) {
Evaluator.evalScript(finalContext, "load('" + s.get().toJavaString() + "')", "<code>", false);
}
return Optional.of(JavaScriptValue.create(System.currentTimeMillis() - sm));
}
}));
context.getGlobalObject().set(context, JavaScriptString.create("read"), JavaScriptJavaCallbackFunctionObject.create(context, "read", 1, false, new JavaScriptJavaCallbackFunctionObject.Callback() {
@Override
public Optional<JavaScriptValue> callback(Context context, JavaScriptValue javaScriptValue, JavaScriptValue[] javaScriptValues) {
Optional<JavaScriptString> s = javaScriptValues[0].toString(finalContext);
if (s.isPresent()) {
FileReader in = null;
try {
byte[] chars = Files.readAllBytes(Paths.get(s.get().toJavaString()));
String fileContent = new String(chars);
return Optional.of(JavaScriptString.create(fileContent));
}
catch (Exception ex) {
return Optional.empty();
}
}
return Optional.empty();
}
}));
}
String source = "load('" + base + "test.js" + "');";
String fileName = "<java code>";
Evaluator.evalScript(context,
source,
fileName,
true);
context = null;
vm = null;
Memory.gc();
Memory.gc();
Memory.gc();
Memory.gc();
Memory.gc();
Globals.finalizeGlobals();
}).start();
}
public void runExample()
{
new Thread(() -> {
Looper.prepare();
Handler handler = new Handler(Looper.myLooper());
Globals.initializeGlobals();
VMInstance vmInstance = VMInstance.create(Optional.empty(), Optional.empty());
Context context = Context.create(vmInstance);
context.getGlobalObject().set(context, JavaScriptString.create("print"), JavaScriptJavaCallbackFunctionObject.create(context, "", 1, false, new JavaScriptJavaCallbackFunctionObject.Callback() {
@Override
public Optional<JavaScriptValue> callback(Context context, JavaScriptValue receiverValue, JavaScriptValue[] arguments) {
System.out.println(arguments[0].toString(context).get().toJavaString());
return Optional.empty();
}
}));
context.getGlobalObject().set(context, JavaScriptString.create("end"), JavaScriptJavaCallbackFunctionObject.create(context, "", 1, false, new JavaScriptJavaCallbackFunctionObject.Callback() {
@Override
public Optional<JavaScriptValue> callback(Context context, JavaScriptValue receiverValue, JavaScriptValue[] arguments) {
Looper.myLooper().quitSafely();
return Optional.empty();
}
}));
MultiThreadExecutor executor = new MultiThreadExecutor(vmInstance, new MultiThreadExecutor.WorkerThreadEndNotifier() {
@Override
public void notify(MultiThreadExecutor executor, MultiThreadExecutor.ExecutorInstance instance) {
handler.post(new Runnable() {
@Override
public void run() {
executor.pumpEventsFromThreadIfNeeds();
}
});
}
});
Bridge.register(context, "HTTP", "get", new Bridge.Adapter() {
@Override
public Optional<JavaScriptValue> callback(Context context, Optional<JavaScriptValue> data) {
String url = "";
if (data.isPresent()) {
Optional<JavaScriptString> mayBeString = data.get().toString(context);
if (mayBeString.isPresent()) {
url = mayBeString.get().toJavaString();
}
}
final String finalURL = url;
MultiThreadExecutor.ExecutorInstance instance = executor.startWorker(context, new MultiThreadExecutor.Executor() {
@Override
public MultiThreadExecutor.ResultBuilderContext run() {
try {
HttpURLConnection connection = (HttpURLConnection)new URL(finalURL).openConnection();
connection.setRequestMethod("GET");
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) { // success
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
return new MultiThreadExecutor.ResultBuilderContext(true, response.toString());
} else {
return new MultiThreadExecutor.ResultBuilderContext(false, "error HTTP return code:" + responseCode);
}
} catch (IOException e) {
return new MultiThreadExecutor.ResultBuilderContext(false, e.toString());
}
}
}, new MultiThreadExecutor.ResultBuilder() {
@Override
public JavaScriptValue build(Context scriptContext, MultiThreadExecutor.ResultBuilderContext builderContext) {
return JavaScriptString.create((String)builderContext.data());
}
});
return Optional.of(instance.promise());
}
});
Evaluator.evalScript(context, "" +
"let promise1 = HTTP.get('https://httpbin.org/get');" +
"let promise2 = HTTP.get('http://google.com');" +
"Promise.allSettled([promise1, promise2]).then(function(v) {" +
"print(JSON.stringify(v));" +
"print('http all end!');" +
"end();" +
"});", "", false);
Looper.loop();
Looper.myLooper().quit();
context = null;
vmInstance = null;
Memory.gc();
Memory.gc();
Memory.gc();
Memory.gc();
Memory.gc();
Globals.finalizeGlobals();
}).start();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
// copy assets to internal storage (for copying js files which are used by test)
copyAssets();
findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
run();
}
});
findViewById(R.id.button2).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
runExample();
}
});
}
}

View file

@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

View file

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

View file

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="run"/>
<Button
android:id="@+id/button2"
android:layout_toRightOf="@id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="mt example"/>
<TextView
android:layout_below="@+id/button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:singleLine="false"
android:text="result"
android:id="@+id/output"
android:textSize="8sp"
/>
</RelativeLayout>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View file

@ -0,0 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.EscargotAndroidTestShell" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>

View file

@ -0,0 +1,3 @@
<resources>
<string name="app_name">Escargot android test shell</string>
</resources>

View file

@ -0,0 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.EscargotAndroidTestShell" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older that API 31
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
<!--
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
-->
</full-backup-content>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<!-- TODO: Use <include> and <exclude> to control what is backed up.
<include .../>
<exclude .../>
-->
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
</data-extraction-rules>

View file

@ -0,0 +1,17 @@
package com.samsung.lwe.escargot.shell;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

View file

@ -0,0 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.10.1' apply false
id 'com.android.library' version '8.10.1' apply false
}

1
build/android/escargot/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

View file

@ -0,0 +1,247 @@
plugins {
id 'com.android.library'
id 'jacoco'
id 'maven-publish'
}
ext {
force64Option = System.getProperty("ESCARGOT_BUILD_64BIT_FORCE_LARGE", "ON")
pthreadKeyOption = System.getProperty("ESCARGOT_BUILD_TLS_ACCESS_BY_PTHREAD_KEY", "OFF")
}
android {
namespace 'com.samsung.lwe.escargot'
compileSdk 36
ndkVersion '28.1.13356709'
defaultConfig {
minSdk 28
targetSdk 36
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
externalNativeBuild {
cmake {
arguments "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON", "-DCMAKE_VERBOSE_MAKEFILE=ON", "-DESCARGOT_HOST=android", "-DESCARGOT_OUTPUT=static_lib", "-DENABLE_SHELL=OFF",
"-DESCARGOT_BUILD_64BIT_FORCE_LARGE="+project.ext.force64Option, "-DESCARGOT_TLS_ACCESS_BY_PTHREAD_KEY="+project.ext.pthreadKeyOption
}
}
ndk {
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
testCoverageEnabled true
jniDebuggable = true
ndk {
debuggable = true
}
}
debugShell {
initWith(buildTypes.debug)
externalNativeBuild {
cmake {
arguments "-DCMAKE_VERBOSE_MAKEFILE=ON", "-DESCARGOT_HOST=android", "-DESCARGOT_OUTPUT=static_lib", "-DENABLE_SHELL=ON"
}
}
}
releaseShell {
initWith(buildTypes.release)
jniDebuggable = true
ndk {
debuggable = true
}
externalNativeBuild {
cmake {
arguments "-DCMAKE_VERBOSE_MAKEFILE=ON", "-DESCARGOT_HOST=android", "-DESCARGOT_OUTPUT=static_lib", "-DENABLE_SHELL=ON"
}
}
}
}
sourceSets {
main.java.srcDirs('src/main/java')
test {
java.srcDir('src/androidTest/java')
}
}
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
}
}
ndkVersion '27.0.12077973'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
publishing {
singleVariant("release") {
// if you don't want sources/javadoc, remove these lines
withSourcesJar()
withJavadocJar()
}
}
}
publishing {
publications {
release(MavenPublication) {
afterEvaluate {
from components.release
}
artifactId "escargot-android"
groupId "com.samsung.lwe.escargot"
version "X.X.X.20XXXXXX.X.XXXXXXXX"
}
}
repositories {
maven {
url "/XXXXXX/android/releases/"
}
}
}
def dirForNativeNoNDK = project.layout.buildDirectory.get().dir("native_nondk")
def srcForNativeNoNDK = project.layout.projectDirectory.dir("src/main/cpp").asFile
task createNativeNoNDK() {
def dstdir = dirForNativeNoNDK.asFile
if (!dstdir.exists()) dstdir.mkdirs()
}
task buildCMakeNativeNoNDK(type: Exec) {
dependsOn createNativeNoNDK
workingDir dirForNativeNoNDK
if (org.gradle.internal.os.OperatingSystem.current().isLinux()) {
commandLine "/usr/bin/env", "cmake", "-DESCARGOT_HOST=linux", "-DESCARGOT_ARCH=x64", "-DESCARGOT_OUTPUT=static_lib",
"-DESCARGOT_BUILD_64BIT_FORCE_LARGE="+project.ext.force64Option,
"-DUNDER_NDK=OFF", srcForNativeNoNDK.absolutePath
} else if (org.gradle.internal.os.OperatingSystem.current().isMacOsX()) {
var javaHome = new ByteArrayOutputStream().withStream { os ->
exec {
executable "/usr/libexec/java_home"
args "-v", "1.8"
standardOutput = os
}
os.toString().trim()
}
var icu4cPath = new ByteArrayOutputStream().withStream { os ->
exec {
commandLine "sh", "-c", "brew --prefix icu4c"
standardOutput = os
}
os.toString().trim()
}
var pkgConfigPath = icu4cPath + "/lib/pkgconfig"
environment("PKG_CONFIG_PATH", pkgConfigPath)
commandLine "/usr/bin/env", "cmake", "-DESCARGOT_HOST=darwin", "-DESCARGOT_ARCH=x64", "-DESCARGOT_OUTPUT=static_lib", "-DUNDER_NDK=OFF",
"-DESCARGOT_BUILD_64BIT_FORCE_LARGE="+project.ext.force64Option,
"-DESCARGOT_LIBICU_SUPPORT_WITH_DLOPEN=OFF",
"-DJAVA_HOME=" + javaHome, "-DJAVA_INCLUDE_PATH=" + javaHome + "/include",
"-DJAVA_INCLUDE_PATH2=" + javaHome + "/include/darwin", "-DJAVA_AWT_INCLUDE_PATH=" + javaHome + "/include",
srcForNativeNoNDK.absolutePath
} else {
// TODO
}
}
task buildGMakeNativeNoNDK(type: Exec) {
dependsOn buildCMakeNativeNoNDK
workingDir dirForNativeNoNDK
commandLine "/usr/bin/env", "make", "-j" + Runtime.getRuntime().availableProcessors().toString();
}
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {
reports {
xml.required = true
html.required = true
}
def mainSrc = "${project.projectDir}/src/main/java"
sourceDirectories.setFrom(files([mainSrc]))
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*',
'android/**/*.*', '**/*Activity*.*']
def debugTree = fileTree(dir: "${buildDir}/intermediates/classes/debug", excludes: fileFilter)
classDirectories.setFrom(files([debugTree]))
executionData.setFrom(fileTree(dir: "${buildDir}/jacoco/testDebugUnitTest.exec"))
}
project.afterEvaluate {
if (org.gradle.internal.os.OperatingSystem.current().isLinux() || org.gradle.internal.os.OperatingSystem.current().isMacOsX()) {
testDebugUnitTest {
dependsOn buildGMakeNativeNoNDK
systemProperty "java.library.path", dirForNativeNoNDK.asFile.absolutePath + ":" + System.getProperty("java.library.path")
}
testReleaseUnitTest {
dependsOn buildGMakeNativeNoNDK
systemProperty "java.library.path", dirForNativeNoNDK.asFile.absolutePath + ":" + System.getProperty("java.library.path")
}
}
}
task clearHostJar(type: Delete) {
delete 'build/libs/escargot.jar'
}
task bundleHostJar(type: Jar) {
dependsOn buildGMakeNativeNoNDK
dependsOn assemble
from(zipTree('build/intermediates/aar_main_jar/release/syncReleaseLibJars/classes.jar'))
from(dirForNativeNoNDK.asFile.toString() + "/libescargot-jni.so")
from(dirForNativeNoNDK.asFile.toString() + "/libescargot-jni.dylib")
rename("libescargot-jni.dylib", "libescargot-jni.so")
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
archiveClassifier.set('sources')
archivesBaseName = "escargot"
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.sourceFiles
android.libraryVariants.all { variant ->
if (variant.name == 'release') {
owner.classpath += variant.javaCompileProvider.get().classpath
}
}
options.memberLevel = JavadocMemberLevel.PRIVATE
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set('javadoc')
archivesBaseName = "escargot"
from javadoc.destinationDir
}
artifacts {
sourcesJar
javadocJar
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.7.0'
testImplementation 'junit:junit:4.13.2'
testImplementation project(path: ':escargot')
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation project(path: ':escargot')
}

View file

@ -0,0 +1,2 @@
-keep class com.samsung.lwe.escargot.* { *; }
-keep enum com.samsung.lwe.escargot.* { *; }

View file

@ -0,0 +1,24 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keep class com.samsung.lwe.escargot.* { *; }
-keep enum com.samsung.lwe.escargot.* { *; }

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>

View file

@ -0,0 +1,59 @@
cmake_minimum_required(VERSION 3.18.1)
project(escargot-jni)
option(UNDER_NDK "Build under the Android NDK" ON)
option(ENABLE_SHELL "Enable shell" OFF)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fexceptions -Wno-conversion-null -fPIC -ftls-model=local-dynamic ")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -ftls-model=local-dynamic ")
if (NOT UNDER_NDK)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -g3")
endif ()
SET (ESCARGOT_ARCH ${ANDROID_SYSROOT_ABI})
# STRING(TOLOWER ${CMAKE_BUILD_TYPE} ESCARGOT_MODE)
SET (ESCARGOT_MODE "release")
SET (ESCARGOT_THREADING ON)
if (ENABLE_SHELL)
SET (ESCARGOT_TEST ON)
SET (ESCARGOT_TEMPORAL ON)
SET (ESCARGOT_EXPORT_ALL ON)
endif ()
ADD_SUBDIRECTORY (${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../ escargot)
FILE (GLOB_RECURSE JNI_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
ADD_LIBRARY (escargot-jni SHARED ${JNI_SRC})
SET(LOG_LIBRARY "")
if (NOT UNDER_NDK)
ADD_DEFINITIONS(-DNDEBUG)
endif ()
if (UNDER_NDK)
FIND_LIBRARY(LOG_LIBRARY log)
# enable 16KB page size (require version of Android NDK >= 27)
TARGET_LINK_OPTIONS(escargot PRIVATE "-Wl,-z,max-page-size=16384")
TARGET_LINK_OPTIONS(escargot-jni PRIVATE "-Wl,-z,max-page-size=16384")
else ()
FIND_PACKAGE(JNI REQUIRED)
INCLUDE_DIRECTORIES(${JNI_INCLUDE_DIRS})
endif ()
TARGET_LINK_LIBRARIES (escargot-jni PRIVATE escargot ${LOG_LIBRARY})
if (ENABLE_SHELL)
SET(CMAKE_EXE_LINKER_FLAGS -Wl,-export-dynamic) # export symbol of Shell.cpp
ADD_COMPILE_OPTIONS(-DNDEBUG -g3 -DESCARGOT_ENABLE_TEST -fPIC)
ADD_LINK_OPTIONS(-static-libstdc++)
ADD_EXECUTABLE(escargot-shell ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../src/shell/Shell.cpp)
TARGET_INCLUDE_DIRECTORIES(escargot-shell PRIVATE ADD_SUBDIRECTORY
(${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../third_party/GCutil/include)
(${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../src))
TARGET_LINK_LIBRARIES (escargot-shell PRIVATE escargot ${LOG_LIBRARY})
ADD_EXECUTABLE(test-data-runner ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../tools/test/test-data-runner/test-data-runner.cpp)
TARGET_COMPILE_OPTIONS(test-data-runner PRIVATE -std=c++11 -fPIC)
endif ()

View file

@ -0,0 +1,350 @@
/*
* Copyright (c) 2023-present Samsung Electronics Co., Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#include "EscargotJNI.h"
JavaVM* g_jvm;
size_t g_nonPointerValueLast = reinterpret_cast<size_t>(ValueRef::createUndefined());
thread_local std::vector<ExecutionStateRef*> ExecutionStateRefTracker::g_lastExecutionStateVector;
jobject createJavaValueObject(JNIEnv* env, jclass clazz, ValueRef* value)
{
jobject valueObject;
if (!value->isStoredInHeap()) {
valueObject = env->NewObject(clazz, env->GetMethodID(clazz, "<init>", "(JZ)V"), reinterpret_cast<jlong>(value), jboolean(false));
} else {
PersistentRefHolder<ValueRef>* pRef = new PersistentRefHolder<ValueRef>(value);
jlong ptr = reinterpret_cast<size_t>(pRef);
valueObject = env->NewObject(clazz, env->GetMethodID(clazz, "<init>", "(J)V"), ptr);
}
return valueObject;
}
jobject createJavaValueObject(JNIEnv* env, const char* className, ValueRef* value)
{
return createJavaValueObject(env, env->FindClass(className), value);
}
ValueRef* unwrapValueRefFromValue(JNIEnv* env, jclass clazz, jobject object)
{
auto ptr = env->GetLongField(object, env->GetFieldID(clazz, "m_nativePointer", "J"));
if (static_cast<size_t>(ptr) <= g_nonPointerValueLast || (static_cast<size_t>(ptr) & 1)) {
return reinterpret_cast<ValueRef*>(ptr);
} else {
PersistentRefHolder<ValueRef>* ref = reinterpret_cast<PersistentRefHolder<ValueRef>*>(ptr);
return ref->get();
}
}
jobject createJavaObjectFromValue(JNIEnv* env, ValueRef* value)
{
if (!value->isStoredInHeap() || value->isNumber()) {
return createJavaValueObject(env, "com/samsung/lwe/escargot/JavaScriptValue", value);
} else if (value->isString()) {
return createJavaValueObject(env, "com/samsung/lwe/escargot/JavaScriptString", value);
} else if (value->isSymbol()) {
return createJavaValueObject(env, "com/samsung/lwe/escargot/JavaScriptSymbol", value);
} else if (value->isBigInt()) {
return createJavaValueObject(env, "com/samsung/lwe/escargot/JavaScriptBigInt", value);
} else if (value->isObject()) {
if (value->isArrayObject()) {
return createJavaValueObject(env, "com/samsung/lwe/escargot/JavaScriptArrayObject", value);
} else if (value->isGlobalObject()) {
return createJavaValueObject(env, "com/samsung/lwe/escargot/JavaScriptGlobalObject", value);
} else if (value->isFunctionObject()) {
if (value->asFunctionObject()->extraData()) {
ScriptObjectExtraData* data = reinterpret_cast<ScriptObjectExtraData*>(value->asFunctionObject()->extraData());
if (data->implementSideData) {
return createJavaValueObject(env, "com/samsung/lwe/escargot/JavaScriptJavaCallbackFunctionObject", value);
}
}
return createJavaValueObject(env, "com/samsung/lwe/escargot/JavaScriptFunctionObject", value);
} else if (value->isPromiseObject()) {
return createJavaValueObject(env, "com/samsung/lwe/escargot/JavaScriptPromiseObject", value);
} else if (value->isErrorObject()) {
return createJavaValueObject(env, "com/samsung/lwe/escargot/JavaScriptErrorObject", value);
} else {
return createJavaValueObject(env, "com/samsung/lwe/escargot/JavaScriptObject", value);
}
} else {
abort();
}
}
jobject createJavaObject(JNIEnv* env, VMInstanceRef* value)
{
PersistentRefHolder<VMInstanceRef>* pRef = new PersistentRefHolder<VMInstanceRef>(value);
jlong ptr = reinterpret_cast<size_t>(pRef);
jclass clazz = env->FindClass("com/samsung/lwe/escargot/VMInstance");
return env->NewObject(clazz, env->GetMethodID(clazz, "<init>", "(J)V"), ptr);
}
jobject createJavaObject(JNIEnv* env, ContextRef* value)
{
PersistentRefHolder<ContextRef>* pRef = new PersistentRefHolder<ContextRef>(value);
jlong ptr = reinterpret_cast<size_t>(pRef);
jclass clazz = env->FindClass("com/samsung/lwe/escargot/Context");
return env->NewObject(clazz, env->GetMethodID(clazz, "<init>", "(J)V"), ptr);
}
OptionalRef<JNIEnv> fetchJNIEnvFromCallback()
{
JNIEnv* env = nullptr;
if (g_jvm->GetEnv(reinterpret_cast<void **>(&env), JNI_VERSION_1_6) == JNI_EDETACHED) {
#if defined(_JAVASOFT_JNI_H_) // oraclejdk or openjdk
if (g_jvm->AttachCurrentThread(reinterpret_cast<void **>(&env), NULL) != 0) {
#else
if (g_jvm->AttachCurrentThread(reinterpret_cast<JNIEnv **>(&env), NULL) != 0) {
#endif
// give up
return nullptr;
}
}
return env;
}
extern "C"
JNIEXPORT void JNICALL
Java_com_samsung_lwe_escargot_Escargot_init(JNIEnv* env, jclass clazz)
{
thread_local static bool inited = false;
if (!inited) {
if (!g_jvm) {
env->GetJavaVM(&g_jvm);
}
inited = true;
}
}
std::string fetchStringFromJavaOptionalString(JNIEnv *env, jobject optional)
{
auto classOptionalString = env->GetObjectClass(optional);
auto methodIsPresent = env->GetMethodID(classOptionalString, "isPresent", "()Z");
if (env->CallBooleanMethod(optional, methodIsPresent)) {
auto methodGet = env->GetMethodID(classOptionalString, "get", "()Ljava/lang/Object;");
jboolean isSucceed;
jstring value = static_cast<jstring>(env->CallObjectMethod(optional, methodGet));
const char* str = env->GetStringUTFChars(
value, &isSucceed);
auto length = env->GetStringUTFLength(value);
auto ret = std::string(str, length);
env->ReleaseStringUTFChars(value, str);
return ret;
}
return std::string();
}
StringRef* createJSStringFromJava(JNIEnv* env, jstring str)
{
if (!str) {
return StringRef::emptyString();
}
jboolean isSucceed;
const char* cString = env->GetStringUTFChars(str, &isSucceed);
StringRef* code = StringRef::createFromUTF8(cString, env->GetStringUTFLength(str));
env->ReleaseStringUTFChars(str, cString);
return code;
}
std::string createStringFromJava(JNIEnv* env, jstring str)
{
if (!str) {
return std::string();
}
jboolean isSucceed;
const char* cString = env->GetStringUTFChars(str, &isSucceed);
std::string ret = std::string(cString, env->GetStringUTFLength(str));
env->ReleaseStringUTFChars(str, cString);
return ret;
}
jstring createJavaStringFromJS(JNIEnv* env, StringRef* string)
{
std::basic_string<uint16_t> buf;
auto bad = string->stringBufferAccessData();
buf.reserve(bad.length);
for (size_t i = 0; i < bad.length ; i ++) {
buf.push_back(bad.charAt(i));
}
return env->NewString(buf.data(), buf.length());
}
void throwJavaRuntimeException(ExecutionStateRef* state)
{
state->throwException(ErrorObjectRef::create(state, ErrorObjectRef::None, StringRef::createFromASCII("Java runtime exception")));
}
bool hasJavaScriptRuntimeExceptionOnEnv(JNIEnv* env)
{
if (env->ExceptionCheck()) {
jthrowable exception = env->ExceptionOccurred();
env->ExceptionClear();
bool ret = env->IsInstanceOf(exception, env->FindClass("com/samsung/lwe/escargot/internal/JavaScriptRuntimeException"));
env->Throw(exception);
return ret;
}
return false;
}
OptionalRef<ValueRef> extractExceptionFromEnv(JNIEnv* env)
{
if (env->ExceptionCheck()) {
jthrowable exception = env->ExceptionOccurred();
env->ExceptionClear();
bool ret = env->IsInstanceOf(exception, env->FindClass("com/samsung/lwe/escargot/internal/JavaScriptRuntimeException"));
if (ret) {
jclass clz = env->FindClass("com/samsung/lwe/escargot/internal/JavaScriptRuntimeException");
jobject jv = env->CallObjectMethod(exception, env->GetMethodID(clz, "exception", "()Lcom/samsung/lwe/escargot/JavaScriptValue;"));
ValueRef* v = unwrapValueRefFromValue(env, env->GetObjectClass(jv), jv);
return v;
} else {
env->Throw(exception);
}
}
return nullptr;
}
bool hasJavaExcpetion(JNIEnv* env)
{
if (env->ExceptionCheck() && !hasJavaScriptRuntimeExceptionOnEnv(env)) {
return true;
}
return false;
}
jobject storeExceptionOnContextAndReturnsIt(JNIEnv* env, jobject contextObject, ContextRef* context, Evaluator::EvaluatorResult& evaluatorResult)
{
if (hasJavaExcpetion(env)) {
return nullptr;
}
auto exceptionOnEnv = extractExceptionFromEnv(env);
jclass optionalClazz = env->FindClass("java/util/Optional");
// store exception to context
auto fieldId = env->GetFieldID(env->GetObjectClass(contextObject), "m_lastThrownException", "Ljava/util/Optional;");
ValueRef* exception = exceptionOnEnv ? exceptionOnEnv.get() : evaluatorResult.error.value();
auto fieldValue = env->CallStaticObjectMethod(optionalClazz,
env->GetStaticMethodID(optionalClazz, "of",
"(Ljava/lang/Object;)Ljava/util/Optional;"),
createJavaObjectFromValue(env, exception));
env->SetObjectField(contextObject, fieldId, fieldValue);
return env->CallStaticObjectMethod(optionalClazz, env->GetStaticMethodID(optionalClazz, "empty",
"()Ljava/util/Optional;"));
}
jobject createOptionalValueFromEvaluatorJavaScriptValueResult(JNIEnv* env, jobject contextObject, ContextRef* context, Evaluator::EvaluatorResult& evaluatorResult)
{
if (hasJavaExcpetion(env)) {
return nullptr;
}
if (evaluatorResult.isSuccessful()) {
jclass optionalClazz = env->FindClass("java/util/Optional");
return env->CallStaticObjectMethod(optionalClazz,
env->GetStaticMethodID(optionalClazz, "of",
"(Ljava/lang/Object;)Ljava/util/Optional;"),
createJavaObjectFromValue(env, evaluatorResult.result));
}
return storeExceptionOnContextAndReturnsIt(env, contextObject, context, evaluatorResult);
}
jobject createOptionalValueFromEvaluatorBooleanResult(JNIEnv* env, jobject contextObject, ContextRef* context, Evaluator::EvaluatorResult& evaluatorResult)
{
if (hasJavaExcpetion(env)) {
return nullptr;
}
if (evaluatorResult.isSuccessful()) {
jclass optionalClazz = env->FindClass("java/util/Optional");
auto booleanClazz = env->FindClass("java/lang/Boolean");
auto valueOfMethodId = env->GetStaticMethodID(booleanClazz, "valueOf", "(Z)Ljava/lang/Boolean;");
auto javaBoolean = env->CallStaticObjectMethod(booleanClazz, valueOfMethodId, (jboolean)evaluatorResult.result->asBoolean());
return env->CallStaticObjectMethod(optionalClazz,
env->GetStaticMethodID(optionalClazz, "of",
"(Ljava/lang/Object;)Ljava/util/Optional;"),
javaBoolean);
}
return storeExceptionOnContextAndReturnsIt(env, contextObject, context, evaluatorResult);
}
jobject createOptionalValueFromEvaluatorIntegerResult(JNIEnv* env, jobject contextObject, ContextRef* context, Evaluator::EvaluatorResult& evaluatorResult)
{
if (hasJavaExcpetion(env)) {
return nullptr;
}
if (evaluatorResult.isSuccessful()) {
jclass optionalClazz = env->FindClass("java/util/Optional");
auto containerClass = env->FindClass("java/lang/Integer");
auto valueOfMethodId = env->GetStaticMethodID(containerClass, "valueOf", "(I)Ljava/lang/Integer;");
auto javaValue = env->CallStaticObjectMethod(containerClass, valueOfMethodId, (jint)evaluatorResult.result->asInt32());
return env->CallStaticObjectMethod(optionalClazz,
env->GetStaticMethodID(optionalClazz, "of",
"(Ljava/lang/Object;)Ljava/util/Optional;"),
javaValue);
}
return storeExceptionOnContextAndReturnsIt(env, contextObject, context, evaluatorResult);
}
jobject createOptionalValueFromEvaluatorDoubleResult(JNIEnv* env, jobject contextObject, ContextRef* context, Evaluator::EvaluatorResult& evaluatorResult)
{
if (hasJavaExcpetion(env)) {
return nullptr;
}
if (evaluatorResult.isSuccessful()) {
jclass optionalClazz = env->FindClass("java/util/Optional");
auto containerClass = env->FindClass("java/lang/Double");
auto valueOfMethodId = env->GetStaticMethodID(containerClass, "valueOf", "(D)Ljava/lang/Double;");
auto javaValue = env->CallStaticObjectMethod(containerClass, valueOfMethodId, (jdouble)evaluatorResult.result->asNumber());
return env->CallStaticObjectMethod(optionalClazz,
env->GetStaticMethodID(optionalClazz, "of",
"(Ljava/lang/Object;)Ljava/util/Optional;"),
javaValue);
}
return storeExceptionOnContextAndReturnsIt(env, contextObject, context, evaluatorResult);
}
ScriptObjectExtraData* ensureScriptObjectExtraData(ObjectRef* ref)
{
ScriptObjectExtraData* data = reinterpret_cast<ScriptObjectExtraData*>(ref->extraData());
if (!data) {
data = new ScriptObjectExtraData;
ref->setExtraData(data);
Memory::gcRegisterFinalizer(ref, [](void* self, void* data) {
ScriptObjectExtraData* extraData = reinterpret_cast<ScriptObjectExtraData*>(reinterpret_cast<ObjectRef*>(self)->extraData());
auto env = fetchJNIEnvFromCallback();
if (env) {
if (extraData->implementSideData) {
env->DeleteGlobalRef(extraData->implementSideData);
extraData->implementSideData = nullptr;
}
if (extraData->userData) {
env->DeleteGlobalRef(extraData->userData);
extraData->userData = nullptr;
}
}
}, nullptr);
}
return data;
}

View file

@ -0,0 +1,185 @@
/*
* Copyright (c) 2023-present Samsung Electronics Co., Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#ifndef ESCARGOT_ANDROID_ESCARGOTJNI_H
#define ESCARGOT_ANDROID_ESCARGOTJNI_H
#include <jni.h>
#include <EscargotPublic.h>
#include <vector>
#include <set>
#include <cassert>
using namespace Escargot;
#if defined(ANDROID)
#include <android/log.h>
#define LOG_TAG "Escargot"
#define LOGUNK(...) __android_log_print(ANDROID_LOG_UNKNOWN,LOG_TAG,__VA_ARGS__)
#define LOGDEF(...) __android_log_print(ANDROID_LOG_DEFAULT,LOG_TAG,__VA_ARGS__)
#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE,LOG_TAG,__VA_ARGS__)
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN,LOG_TAG,__VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
#define LOGF(...) __android_log_print(ANDROID_FATAL_ERROR,LOG_TAG,__VA_ARGS__)
#define LOGS(...) __android_log_print(ANDROID_SILENT_ERROR,LOG_TAG,__VA_ARGS__)
#else
#define LOGUNK(...) fprintf(stdout,__VA_ARGS__)
#define LOGDEF(...) fprintf(stdout,__VA_ARGS__)
#define LOGV(...) fprintf(stdout,__VA_ARGS__)
#define LOGD(...) fprintf(stdout,__VA_ARGS__)
#define LOGI(...) fprintf(stdout,__VA_ARGS__)
#define LOGW(...) fprintf(stdout,__VA_ARGS__)
#define LOGE(...) fprintf(stderr,__VA_ARGS__)
#define LOGF(...) fprintf(stderr,__VA_ARGS__)
#define LOGS(...) fprintf(stderr,__VA_ARGS__)
#endif
#define THROW_NPE_RETURN_NULL(param, paramType) \
if (env->ExceptionCheck()) { \
return 0; \
} \
if (!param) { \
env->ThrowNew(env->FindClass("java/lang/NullPointerException"), paramType" cannot be null"); \
return 0; \
}
#define THROW_NPE_RETURN_VOID(param, paramType) \
if (env->ExceptionCheck()) { \
return; \
} \
if (!param) { \
env->ThrowNew(env->FindClass("java/lang/NullPointerException"), paramType" cannot be null"); \
return; \
}
#define THROW_CAST_EXCEPTION_IF_NEEDS(param, value, typeName) \
if (env->ExceptionCheck()) { \
return NULL; \
} \
if (!value->is##typeName()) { \
env->ThrowNew(env->FindClass("java/lang/ClassCastException"), "Can not cast to " #typeName); \
return NULL; \
}
extern JavaVM* g_jvm;
extern size_t g_nonPointerValueLast;
jobject createJavaValueObject(JNIEnv* env, jclass clazz, ValueRef* value);
jobject createJavaValueObject(JNIEnv* env, const char* className, ValueRef* value);
jobject createJavaObject(JNIEnv* env, VMInstanceRef* value);
jobject createJavaObject(JNIEnv* env, ContextRef* value);
ValueRef* unwrapValueRefFromValue(JNIEnv* env, jclass clazz, jobject object);
jobject createJavaObjectFromValue(JNIEnv* env, ValueRef* value);
ValueRef* unwrapValueRefFromValue(JNIEnv* env, jclass clazz, jobject object);
OptionalRef<JNIEnv> fetchJNIEnvFromCallback();
std::string fetchStringFromJavaOptionalString(JNIEnv *env, jobject optional);
StringRef* createJSStringFromJava(JNIEnv* env, jstring str);
std::string createStringFromJava(JNIEnv* env, jstring str);
jstring createJavaStringFromJS(JNIEnv* env, StringRef* string);
void throwJavaRuntimeException(ExecutionStateRef* state);
OptionalRef<ValueRef> extractExceptionFromEnv(JNIEnv* env);
jobject storeExceptionOnContextAndReturnsIt(JNIEnv* env, jobject contextObject, ContextRef* context, Evaluator::EvaluatorResult& evaluatorResult);
jobject createOptionalValueFromEvaluatorJavaScriptValueResult(JNIEnv* env, jobject contextObject, ContextRef* context, Evaluator::EvaluatorResult& evaluatorResult);
jobject createOptionalValueFromEvaluatorBooleanResult(JNIEnv* env, jobject contextObject, ContextRef* context, Evaluator::EvaluatorResult& evaluatorResult);
jobject createOptionalValueFromEvaluatorIntegerResult(JNIEnv* env, jobject contextObject, ContextRef* context, Evaluator::EvaluatorResult& evaluatorResult);
jobject createOptionalValueFromEvaluatorDoubleResult(JNIEnv* env, jobject contextObject, ContextRef* context, Evaluator::EvaluatorResult& evaluatorResult);
struct ScriptObjectExtraData {
jobject userData;
jobject implementSideData;
ScriptObjectExtraData()
: userData(nullptr)
, implementSideData(nullptr)
{
}
void* operator new(size_t t)
{
return Memory::gcMallocAtomic(sizeof(ScriptObjectExtraData));
}
};
ScriptObjectExtraData* ensureScriptObjectExtraData(ObjectRef* ref);
template<typename T>
jobject nativeOptionalValueIntoJavaOptionalValue(JNIEnv* env, OptionalRef<T> ref)
{
if (env->ExceptionCheck()) {
return nullptr;
}
jclass optionalClazz = env->FindClass("java/util/Optional");
if (ref) {
jmethodID ctorMethod = env->GetStaticMethodID(optionalClazz, "of",
"(Ljava/lang/Object;)Ljava/util/Optional;");
return env->CallStaticObjectMethod(optionalClazz, ctorMethod, createJavaObjectFromValue(env, ref.value()));
}
return env->CallStaticObjectMethod(optionalClazz, env->GetStaticMethodID(optionalClazz, "empty",
"()Ljava/util/Optional;"));
}
template<typename NativeType>
PersistentRefHolder<NativeType>* getPersistentPointerFromJava(JNIEnv *env, jclass clazz, jobject object)
{
auto ptr = env->GetLongField(object, env->GetFieldID(clazz, "m_nativePointer", "J"));
PersistentRefHolder<NativeType>* pVMRef = reinterpret_cast<PersistentRefHolder<NativeType>*>(ptr);
return pVMRef;
}
class ExecutionStateRefTracker {
public:
ExecutionStateRefTracker(ExecutionStateRef* newValue)
{
g_lastExecutionStateVector.push_back(newValue);
}
~ExecutionStateRefTracker()
{
g_lastExecutionStateVector.pop_back();
}
private:
friend class ScriptEvaluator;
static thread_local std::vector<ExecutionStateRef*> g_lastExecutionStateVector;
};
class ScriptEvaluator {
public:
template <typename... Args, typename F>
static Evaluator::EvaluatorResult execute(ContextRef* ctx, F&& closure, Args... args)
{
typedef ValueRef* (*Closure)(ExecutionStateRef * state, Args...);
if (ExecutionStateRefTracker::g_lastExecutionStateVector.size()) {
return Evaluator::execute(ExecutionStateRefTracker::g_lastExecutionStateVector.back(), [](ExecutionStateRef * state, Closure closure, Args... args) -> ValueRef* {
ExecutionStateRefTracker tracker(state);
return closure(state, args...);
}, Closure(closure), args...);
} else {
return Evaluator::execute(ctx, [](ExecutionStateRef * state, Closure closure, Args... args) -> ValueRef* {
ExecutionStateRefTracker tracker(state);
return closure(state, args...);
}, Closure(closure), args...);
}
}
};
#endif //ESCARGOT_ANDROID_ESCARGOTJNI_H

View file

@ -0,0 +1,74 @@
/*
* Copyright (c) 2023-present Samsung Electronics Co., Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#include "EscargotJNI.h"
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptArrayObject_create(JNIEnv* env, jclass clazz,
jobject context)
{
THROW_NPE_RETURN_NULL(context, "Context");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state) -> ValueRef* {
return ArrayObjectRef::create(state);
});
assert(evaluatorResult.isSuccessful());
return createJavaObjectFromValue(env, evaluatorResult.result->asArrayObject());
}
extern "C"
JNIEXPORT jlong JNICALL
Java_com_samsung_lwe_escargot_JavaScriptArrayObject_length(JNIEnv* env, jobject thiz, jobject context)
{
THROW_NPE_RETURN_NULL(context, "Context");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
ArrayObjectRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asArrayObject();
int64_t length = 0;
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, ArrayObjectRef* thisValueRef, int64_t* pLength) -> ValueRef* {
*pLength = static_cast<int64_t>(thisValueRef->length(state));
return ValueRef::createUndefined();
}, thisValueRef, &length);
return length;
}
extern "C"
JNIEXPORT void JNICALL
Java_com_samsung_lwe_escargot_JavaScriptArrayObject_setLength(JNIEnv* env, jobject thiz,
jobject context, jlong newLength)
{
THROW_NPE_RETURN_VOID(context, "Context");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
ArrayObjectRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asArrayObject();
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, ArrayObjectRef* thisValueRef, jlong pLength) -> ValueRef* {
if (pLength >= 0) {
thisValueRef->setLength(state, static_cast<uint64_t>(pLength));
} else {
thisValueRef->set(state, AtomicStringRef::create(state->context(), "length")->string(), ValueRef::create(pLength));
}
return ValueRef::createUndefined();
}, thisValueRef, newLength);
}

View file

@ -0,0 +1,80 @@
/*
* Copyright (c) 2023-present Samsung Electronics Co., Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#include "EscargotJNI.h"
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptBigInt_create__I(JNIEnv* env, jclass clazz, jint num)
{
return createJavaValueObject(env, clazz, BigIntRef::create(static_cast<int64_t>(num)));
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptBigInt_create__J(JNIEnv* env, jclass clazz, jlong num)
{
return createJavaValueObject(env, clazz, BigIntRef::create(static_cast<int64_t>(num)));
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptBigInt_create__Ljava_lang_String_2I(JNIEnv* env,
jclass clazz,
jstring numString,
jint radix)
{
return createJavaValueObject(env, clazz,
BigIntRef::create(createJSStringFromJava(env, numString), radix));
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptBigInt_create__Lcom_samsung_lwe_escargot_JavaScriptString_2I(
JNIEnv* env, jclass clazz, jobject numString, jint radix)
{
if (numString) {
return createJavaValueObject(env, clazz,
BigIntRef::create(unwrapValueRefFromValue(env, env->GetObjectClass(
numString), numString)->asString(), radix));
} else {
return createJavaValueObject(env, clazz, BigIntRef::create(static_cast<int64_t>(0)));
}
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptBigInt_toString(JNIEnv* env, jobject thiz, jint radix)
{
return createJavaObjectFromValue(env, unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asBigInt()->toString(radix));
}
extern "C"
JNIEXPORT jdouble JNICALL
Java_com_samsung_lwe_escargot_JavaScriptBigInt_toNumber(JNIEnv* env, jobject thiz)
{
return unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asBigInt()->toNumber();
}
extern "C"
JNIEXPORT jlong JNICALL
Java_com_samsung_lwe_escargot_JavaScriptBigInt_toInt64(JNIEnv* env, jobject thiz)
{
return unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asBigInt()->toInt64();
}

View file

@ -0,0 +1,153 @@
/*
* Copyright (c) 2023-present Samsung Electronics Co., Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#include "EscargotJNI.h"
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_Bridge_register(JNIEnv* env, jclass clazz, jobject context,
jstring objectName, jstring propertyName,
jobject adapter)
{
THROW_NPE_RETURN_NULL(context, "Context");
THROW_NPE_RETURN_NULL(adapter, "Adapter");
auto contextPtr = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context),
context);
auto jsObjectName = createJSStringFromJava(env, objectName);
auto jsPropertyName = createJSStringFromJava(env, propertyName);
if (!jsObjectName->length() || !jsPropertyName->length()) {
return 0;
}
adapter = env->NewGlobalRef(adapter);
auto evalResult = ScriptEvaluator::execute(contextPtr->get(),
[](ExecutionStateRef* state, JNIEnv* env, jobject adapter,
StringRef* jsObjectName,
StringRef* jsPropertyName) -> ValueRef* {
auto globalObject = state->context()->globalObject();
ObjectRef* targetObject;
ValueRef* willBeTargetObject = globalObject->getOwnProperty(
state, jsObjectName);
if (willBeTargetObject->isObject()) {
targetObject = willBeTargetObject->asObject();
} else {
targetObject = ObjectRef::create(state);
globalObject->defineDataProperty(state,
jsObjectName,
targetObject,
true, true, true);
}
FunctionObjectRef::NativeFunctionInfo info(
AtomicStringRef::create(state->context(), jsPropertyName),
[](ExecutionStateRef* state,
ValueRef* thisValue, size_t argc,
ValueRef** argv,
bool isConstructorCall) -> ValueRef* {
ExecutionStateRefTracker tracker(state);
FunctionObjectRef* callee = state->resolveCallee().get();
jobject jo = ensureScriptObjectExtraData(
reinterpret_cast<FunctionObjectRef*>(callee))->implementSideData;
auto env = fetchJNIEnvFromCallback();
if (!env) {
// give up
LOGE("could not fetch env from callback");
return ValueRef::createUndefined();
}
if (env->ExceptionCheck()) {
throwJavaRuntimeException(state);
return ValueRef::createUndefined();
}
env->PushLocalFrame(32);
jobject callbackArg;
jclass optionalClazz = env->FindClass(
"java/util/Optional");
if (argc) {
callbackArg = env->CallStaticObjectMethod(
optionalClazz,
env->GetStaticMethodID(
optionalClazz, "of",
"(Ljava/lang/Object;)Ljava/util/Optional;"),
createJavaObjectFromValue(env.get(), argv[0]));
} else {
callbackArg = env->CallStaticObjectMethod(
optionalClazz,
env->GetStaticMethodID(
optionalClazz, "empty",
"()Ljava/util/Optional;"));
}
auto javaReturnValue = env->CallObjectMethod(
jo,
env->GetMethodID(
env->GetObjectClass(jo),
"callback",
"(Lcom/samsung/lwe/escargot/Context;Ljava/util/Optional;)Ljava/util/Optional;"),
createJavaObject(env.get(), callee->context()),
callbackArg);
if (env->ExceptionCheck()) {
env->PopLocalFrame(NULL);
throwJavaRuntimeException(state);
return ValueRef::createUndefined();
}
auto methodIsPresent = env->GetMethodID(
optionalClazz, "isPresent", "()Z");
ValueRef* nativeReturnValue = ValueRef::createUndefined();
if (javaReturnValue && env->CallBooleanMethod(javaReturnValue,
methodIsPresent)) {
auto methodGet = env->GetMethodID(
optionalClazz, "get",
"()Ljava/lang/Object;");
jobject value = env->CallObjectMethod(
javaReturnValue, methodGet);
nativeReturnValue = unwrapValueRefFromValue(
env.get(),
env->GetObjectClass(value),
value);
}
env->PopLocalFrame(NULL);
return nativeReturnValue;
}, 1, true, false);
FunctionObjectRef* callback = FunctionObjectRef::create(
state, info);
targetObject->defineDataProperty(state, jsPropertyName,
callback, true, true,
true);
return callback;
}, env, adapter, jsObjectName, jsPropertyName);
if (evalResult.isSuccessful()) {
FunctionObjectRef* callback = evalResult.result->asFunctionObject();
ensureScriptObjectExtraData(callback)->implementSideData = adapter;
} else {
env->DeleteGlobalRef(adapter);
}
return evalResult.isSuccessful();
}

View file

@ -0,0 +1,61 @@
/*
* Copyright (c) 2023-present Samsung Electronics Co., Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#include "EscargotJNI.h"
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_Context_create(JNIEnv* env, jclass clazz, jobject vmInstance)
{
THROW_NPE_RETURN_NULL(vmInstance, "VMInstance");
auto vmPtr = getPersistentPointerFromJava<VMInstanceRef>(env, env->GetObjectClass(vmInstance),
vmInstance);
auto contextRef = ContextRef::create(vmPtr->get());
return createJavaObject(env, contextRef.get());
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_Context_getGlobalObject(JNIEnv* env, jobject thiz)
{
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(thiz), thiz);
return createJavaObjectFromValue(env, contextRef->get()->globalObject());
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_Context_throwException(JNIEnv* env, jobject thiz, jobject exception)
{
THROW_NPE_RETURN_NULL(exception, "JavaScriptValue");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(thiz), thiz);
if (contextRef->get()->canThrowException()) {
ValueRef* exceptionRef = unwrapValueRefFromValue(env, env->GetObjectClass(exception), exception);
if (exceptionRef->isErrorObject()) {
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, ValueRef* exceptionRef) -> ValueRef* {
exceptionRef->asErrorObject()->updateStackTraceData(state);
return ValueRef::createUndefined();
}, exceptionRef);
}
jclass clz = env->FindClass("com/samsung/lwe/escargot/internal/JavaScriptRuntimeException");
jobject obj = env->NewObject(clz, env->GetMethodID(clz, "<init>", "(Lcom/samsung/lwe/escargot/JavaScriptValue;)V"), exception);
env->Throw(static_cast<jthrowable>(obj));
}
return false;
}

View file

@ -0,0 +1,80 @@
/*
* Copyright (c) 2023-present Samsung Electronics Co., Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#include "EscargotJNI.h"
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptErrorObject_create(JNIEnv* env, jclass clazz,
jobject context, jobject kind,
jstring message)
{
THROW_NPE_RETURN_NULL(context, "Context");
THROW_NPE_RETURN_NULL(kind, "ErrorKind");
THROW_NPE_RETURN_NULL(message, "String");
auto nameMethod = env->GetMethodID(env->GetObjectClass(kind), "name", "()Ljava/lang/String;");
auto kindName = (jstring)env->CallObjectMethod(kind, nameMethod);
auto string = createStringFromJava(env, kindName);
ErrorObjectRef::Code code = Escargot::ErrorObjectRef::None;
if (string == "ReferenceError") {
code = Escargot::ErrorObjectRef::ReferenceError;
} else if (string == "TypeError") {
code = Escargot::ErrorObjectRef::TypeError;
} else if (string == "SyntaxError") {
code = Escargot::ErrorObjectRef::SyntaxError;
} else if (string == "RangeError") {
code = Escargot::ErrorObjectRef::RangeError;
} else if (string == "URIError") {
code = Escargot::ErrorObjectRef::URIError;
} else if (string == "EvalError") {
code = Escargot::ErrorObjectRef::EvalError;
} else if (string == "AggregateError") {
code = Escargot::ErrorObjectRef::AggregateError;
}
StringRef* jsMessage = createJSStringFromJava(env, message);
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state,
ErrorObjectRef::Code code, StringRef* jsMessage) -> ValueRef* {
return ErrorObjectRef::create(state, code, jsMessage);
}, code, jsMessage);
assert(evaluatorResult.isSuccessful());
return createJavaObjectFromValue(env, evaluatorResult.result->asErrorObject());
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptErrorObject_stack(JNIEnv* env, jobject thiz,
jobject context)
{
THROW_NPE_RETURN_NULL(context, "Context");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
ErrorObjectRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asErrorObject();
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, ErrorObjectRef* thisValueRef) -> ValueRef* {
return thisValueRef->getOwnProperty(state, StringRef::createFromASCII("stack"))->toString(state);
}, thisValueRef);
return createOptionalValueFromEvaluatorJavaScriptValueResult(env, context, contextRef->get(), evaluatorResult);
}

View file

@ -0,0 +1,118 @@
/*
* Copyright (c) 2023-present Samsung Electronics Co., Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#include "EscargotJNI.h"
static bool stringEndsWith(const std::string& str, const std::string& suffix)
{
return str.size() >= suffix.size() && 0 == str.compare(str.size() - suffix.size(), suffix.size(), suffix);
}
static Evaluator::EvaluatorResult evalScript(ContextRef* context, StringRef* source, StringRef* srcName, bool shouldPrintScriptResult, bool shouldExecutePendingJobsAtEnd, bool isModule)
{
if (stringEndsWith(srcName->toStdUTF8String(), "mjs")) {
isModule = isModule || true;
}
auto scriptInitializeResult = context->scriptParser()->initializeScript(source, srcName, isModule);
if (!scriptInitializeResult.script) {
LOGD("Script parsing error: ");
switch (scriptInitializeResult.parseErrorCode) {
case Escargot::ErrorObjectRef::Code::SyntaxError:
LOGD("SyntaxError");
break;
case Escargot::ErrorObjectRef::Code::EvalError:
LOGD("EvalError");
break;
case Escargot::ErrorObjectRef::Code::RangeError:
LOGD("RangeError");
break;
case Escargot::ErrorObjectRef::Code::ReferenceError:
LOGD("ReferenceError");
break;
case Escargot::ErrorObjectRef::Code::TypeError:
LOGD("TypeError");
break;
case Escargot::ErrorObjectRef::Code::URIError:
LOGD("URIError");
break;
default:
break;
}
LOGD(": %s\n", scriptInitializeResult.parseErrorMessage->toStdUTF8String().data());
Evaluator::EvaluatorResult evalResult;
evalResult.error = StringRef::createFromASCII("script parsing error");
return evalResult;
}
auto evalResult = ScriptEvaluator::execute(context, [](ExecutionStateRef* state, ScriptRef* script) -> ValueRef* {
return script->execute(state);
},
scriptInitializeResult.script.get());
if (!evalResult.isSuccessful()) {
if (shouldPrintScriptResult) {
LOGD("Uncaught %s:\n", evalResult.resultOrErrorToString(context)->toStdUTF8String().data());
for (size_t i = 0; i < evalResult.stackTrace.size(); i++) {
LOGD("%s (%d:%d)\n", evalResult.stackTrace[i].srcName->toStdUTF8String().data(), (int)evalResult.stackTrace[i].loc.line, (int)evalResult.stackTrace[i].loc.column);
}
}
} else {
if (shouldPrintScriptResult) {
LOGD("%s", evalResult.resultOrErrorToString(context)->toStdUTF8String().data());
}
}
if (shouldExecutePendingJobsAtEnd) {
while (context->vmInstance()->hasPendingJob() || context->vmInstance()->hasPendingJobFromAnotherThread()) {
if (context->vmInstance()->waitEventFromAnotherThread(10)) {
context->vmInstance()->executePendingJobFromAnotherThread();
}
if (context->vmInstance()->hasPendingJob()) {
auto jobResult = context->vmInstance()->executePendingJob();
if (shouldPrintScriptResult) {
if (jobResult.error) {
LOGD("Uncaught %s:(in promise job)\n", jobResult.resultOrErrorToString(context)->toStdUTF8String().data());
} else {
LOGD("%s(in promise job)\n", jobResult.resultOrErrorToString(context)->toStdUTF8String().data());
}
}
}
}
}
return evalResult;
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_Evaluator_evalScript(JNIEnv* env, jclass clazz, jobject context,
jstring source, jstring sourceFileName,
jboolean shouldPrintScriptResult,
jboolean shouldExecutePendingJobsAtEnd)
{
THROW_NPE_RETURN_NULL(context, "Context");
auto ptr = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
Evaluator::EvaluatorResult result = evalScript(ptr->get(), createJSStringFromJava(env, source),
createJSStringFromJava(env, sourceFileName), shouldPrintScriptResult,
shouldExecutePendingJobsAtEnd, false);
return createOptionalValueFromEvaluatorJavaScriptValueResult(env, context, ptr->get(), result);
}

View file

@ -0,0 +1,113 @@
/*
* Copyright (c) 2023-present Samsung Electronics Co., Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#include "EscargotJNI.h"
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptFunctionObject_context(JNIEnv* env, jobject thiz)
{
FunctionObjectRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asFunctionObject();
return createJavaObject(env, thisValueRef->context());
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptJavaCallbackFunctionObject_create(JNIEnv* env, jclass clazz,
jobject context,
jstring functionName,
jint argumentCount,
jboolean isConstructor,
jobject callback)
{
THROW_NPE_RETURN_NULL(context, "Context");
THROW_NPE_RETURN_NULL(callback, "Callback");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context),
context);
FunctionObjectRef::NativeFunctionInfo info(
AtomicStringRef::create(contextRef->get(), createJSStringFromJava(env, functionName)),
[](ExecutionStateRef* state, ValueRef* thisValue, size_t argc, ValueRef** argv, bool isConstructorCall) -> ValueRef* {
auto env = fetchJNIEnvFromCallback();
if (!env) {
LOGE("failed to fetch env from function callback");
return ValueRef::createUndefined();
}
if (env->ExceptionCheck()) {
throwJavaRuntimeException(state);
return ValueRef::createUndefined();
}
ExecutionStateRefTracker tracker(state);
env->PushLocalFrame(32);
jobject callback = ensureScriptObjectExtraData(state->resolveCallee().get())->implementSideData;
auto callbackMethodId = env->GetMethodID(env->GetObjectClass(callback), "callback",
"(Lcom/samsung/lwe/escargot/Context;Lcom/samsung/lwe/escargot/JavaScriptValue;[Lcom/samsung/lwe/escargot/JavaScriptValue;)Ljava/util/Optional;");
jobjectArray javaArgv = env->NewObjectArray(argc, env->FindClass("com/samsung/lwe/escargot/JavaScriptValue"), nullptr);
for (size_t i = 0; i < argc; i ++) {
auto ref = createJavaObjectFromValue(env.get(), argv[i]);
env->SetObjectArrayElement(javaArgv, i, ref);
env->DeleteLocalRef(ref);
}
jobject returnValue = env->CallObjectMethod(
callback,
callbackMethodId,
createJavaObject(env.get(), state->resolveCallee()->context()),
createJavaObjectFromValue(env.get(), thisValue),
javaArgv
);
if (env->ExceptionCheck()) {
env->PopLocalFrame(NULL);
throwJavaRuntimeException(state);
return ValueRef::createUndefined();
}
ValueRef* nativeReturnValue = ValueRef::createUndefined();
if (returnValue) {
auto classOptional = env->GetObjectClass(returnValue);
auto methodIsPresent = env->GetMethodID(classOptional, "isPresent", "()Z");
if (env->CallBooleanMethod(returnValue, methodIsPresent)) {
auto methodGet = env->GetMethodID(classOptional, "get", "()Ljava/lang/Object;");
jobject callbackReturnValue = env->CallObjectMethod(returnValue, methodGet);
nativeReturnValue = unwrapValueRefFromValue(env.get(), env->GetObjectClass(callbackReturnValue), callbackReturnValue);
}
}
env->PopLocalFrame(NULL);
return nativeReturnValue;
},
argumentCount,
isConstructor);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(),
[](ExecutionStateRef* state, FunctionObjectRef::NativeFunctionInfo info) -> ValueRef* {
return FunctionObjectRef::create(state, info);
}, info);
assert(evaluatorResult.isSuccessful());
callback = env->NewGlobalRef(callback);
FunctionObjectRef* fn = evaluatorResult.result->asFunctionObject();
ensureScriptObjectExtraData(fn)->implementSideData = callback;
return createJavaValueObject(env, "com/samsung/lwe/escargot/JavaScriptJavaCallbackFunctionObject", fn);
}

View file

@ -0,0 +1,137 @@
/*
* Copyright (c) 2023-present Samsung Electronics Co., Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#include "EscargotJNI.h"
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptGlobalObject_jsonStringify(JNIEnv* env, jobject thiz,
jobject context, jobject input)
{
THROW_NPE_RETURN_NULL(context, "Context");
THROW_NPE_RETURN_NULL(input, "JavaScriptValue");
auto globalObjectRef = getPersistentPointerFromJava<GlobalObjectRef>(env, env->GetObjectClass(context), thiz);
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
ValueRef* inputValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(input), input);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, GlobalObjectRef* globalObject, ValueRef* inputValueRef) -> ValueRef* {
return globalObject->jsonStringify()->call(state, globalObject->json(), 1, &inputValueRef);
}, globalObjectRef->get(), inputValueRef);
return createOptionalValueFromEvaluatorJavaScriptValueResult(env, context, contextRef->get(),
evaluatorResult);
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptGlobalObject_jsonParse(JNIEnv* env, jobject thiz,
jobject context, jobject input)
{
THROW_NPE_RETURN_NULL(context, "Context");
THROW_NPE_RETURN_NULL(input, "JavaScriptValue");
auto globalObjectRef = getPersistentPointerFromJava<GlobalObjectRef>(env, env->GetObjectClass(context), thiz);
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
ValueRef* inputValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(input), input);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, GlobalObjectRef* globalObject, ValueRef* inputValueRef) -> ValueRef* {
return globalObject->jsonParse()->call(state, globalObject->json(), 1, &inputValueRef);
}, globalObjectRef->get(), inputValueRef);
return createOptionalValueFromEvaluatorJavaScriptValueResult(env, context, contextRef->get(),
evaluatorResult);
}
static jobject callPromiseBuiltinFunction(JNIEnv* env, jobject thiz, jobject context, jobject iterable,
ValueRef* (*closure)(ExecutionStateRef* state, GlobalObjectRef* globalObject, ValueRef* iterableValueRef))
{
THROW_NPE_RETURN_NULL(context, "Context");
THROW_NPE_RETURN_NULL(iterable, "JavaScriptValue");
auto globalObjectRef = getPersistentPointerFromJava<GlobalObjectRef>(env, env->GetObjectClass(context), thiz);
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
ValueRef* iterableValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(iterable), iterable);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), closure, globalObjectRef->get(), iterableValueRef);
return createOptionalValueFromEvaluatorJavaScriptValueResult(env, context, contextRef->get(),
evaluatorResult);
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptGlobalObject_promiseAll(JNIEnv* env, jobject thiz,
jobject context, jobject iterable)
{
return callPromiseBuiltinFunction(env, thiz, context, iterable, [](ExecutionStateRef* state, GlobalObjectRef* globalObject, ValueRef* iterableValueRef) -> ValueRef* {
return globalObject->promiseAll()->call(state, globalObject->promise(), 1, &iterableValueRef);
});
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptGlobalObject_promiseAllSettled(JNIEnv* env, jobject thiz,
jobject context,
jobject iterable)
{
return callPromiseBuiltinFunction(env, thiz, context, iterable, [](ExecutionStateRef* state, GlobalObjectRef* globalObject, ValueRef* iterableValueRef) -> ValueRef* {
return globalObject->promiseAllSettled()->call(state, globalObject->promise(), 1, &iterableValueRef);
});
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptGlobalObject_promiseAny(JNIEnv* env, jobject thiz,
jobject context, jobject iterable)
{
return callPromiseBuiltinFunction(env, thiz, context, iterable, [](ExecutionStateRef* state, GlobalObjectRef* globalObject, ValueRef* iterableValueRef) -> ValueRef* {
return globalObject->promiseAny()->call(state, globalObject->promise(), 1, &iterableValueRef);
});
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptGlobalObject_promiseRace(JNIEnv* env, jobject thiz,
jobject context, jobject iterable)
{
return callPromiseBuiltinFunction(env, thiz, context, iterable, [](ExecutionStateRef* state, GlobalObjectRef* globalObject, ValueRef* iterableValueRef) -> ValueRef* {
return globalObject->promiseRace()->call(state, globalObject->promise(), 1, &iterableValueRef);
});
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptGlobalObject_promiseReject(JNIEnv* env, jobject thiz,
jobject context,
jobject iterable)
{
return callPromiseBuiltinFunction(env, thiz, context, iterable, [](ExecutionStateRef* state, GlobalObjectRef* globalObject, ValueRef* iterableValueRef) -> ValueRef* {
return globalObject->promiseReject()->call(state, globalObject->promise(), 1, &iterableValueRef);
});
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptGlobalObject_promiseResolve(JNIEnv* env, jobject thiz,
jobject context,
jobject iterable)
{
return callPromiseBuiltinFunction(env, thiz, context, iterable, [](ExecutionStateRef* state, GlobalObjectRef* globalObject, ValueRef* iterableValueRef) -> ValueRef* {
return globalObject->promiseResolve()->call(state, globalObject->promise(), 1,
&iterableValueRef);
});
}

View file

@ -0,0 +1,319 @@
/*
* Copyright (c) 2023-present Samsung Electronics Co., Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#include "EscargotJNI.h"
static void gcCallback(void* data)
{
auto env = fetchJNIEnvFromCallback();
if (!env) {
LOGE("failed to fetch env from gc event callback");
return;
}
if (!env->ExceptionCheck()) {
env->PushLocalFrame(32);
jclass clazz = env->FindClass("com/samsung/lwe/escargot/NativePointerHolder");
jmethodID mId = env->GetStaticMethodID(clazz, "cleanUp", "()V");
env->CallStaticVoidMethod(clazz, mId);
env->PopLocalFrame(NULL);
}
}
static OptionalRef<StringRef> builtinHelperFileRead(OptionalRef<ExecutionStateRef> state, const char* fileName, const char* builtinName)
{
FILE* fp = fopen(fileName, "r");
if (fp) {
StringRef* src = StringRef::emptyString();
std::string utf8Str;
std::basic_string<unsigned char, std::char_traits<unsigned char>> str;
char buf[512];
bool hasNonLatin1Content = false;
size_t readLen;
while ((readLen = fread(buf, 1, sizeof buf, fp))) {
if (!hasNonLatin1Content) {
for (size_t i = 0; i < readLen; i++) {
unsigned char ch = buf[i];
if (ch & 0x80) {
// check non-latin1 character
hasNonLatin1Content = true;
fseek(fp, 0, SEEK_SET);
break;
}
str += ch;
}
} else {
utf8Str.append(buf, readLen);
}
}
fclose(fp);
if (StringRef::isCompressibleStringEnabled()) {
if (state) {
if (hasNonLatin1Content) {
src = StringRef::createFromUTF8ToCompressibleString(state->context()->vmInstance(), utf8Str.data(), utf8Str.length(), false);
} else {
src = StringRef::createFromLatin1ToCompressibleString(state->context()->vmInstance(), str.data(), str.length());
}
} else {
if (hasNonLatin1Content) {
src = StringRef::createFromUTF8(utf8Str.data(), utf8Str.length(), false);
} else {
src = StringRef::createFromLatin1(str.data(), str.length());
}
}
} else {
if (hasNonLatin1Content) {
src = StringRef::createFromUTF8(utf8Str.data(), utf8Str.length(), false);
} else {
src = StringRef::createFromLatin1(str.data(), str.length());
}
}
return src;
} else {
if (state) {
const size_t maxNameLength = 980;
if ((strnlen(builtinName, maxNameLength) + strnlen(fileName, maxNameLength)) < maxNameLength) {
char msg[1024];
snprintf(msg, sizeof(msg), "GlobalObject.%s: cannot open file %s", builtinName, fileName);
state->throwException(URIErrorObjectRef::create(state.get(), StringRef::createFromUTF8(msg, strnlen(msg, sizeof msg))));
} else {
state->throwException(URIErrorObjectRef::create(state.get(), StringRef::createFromASCII("invalid file name")));
}
} else {
LOGE("%s", fileName);
}
return nullptr;
}
}
class ShellPlatform : public PlatformRef {
public:
bool m_canBlock;
ShellPlatform()
: m_canBlock(true)
{
}
void setCanBlock(bool b)
{
m_canBlock = b;
}
virtual void markJSJobEnqueued(ContextRef* relatedContext) override
{
// ignore. we always check pending job after eval script
}
virtual void markJSJobFromAnotherThreadExists(ContextRef* relatedContext) override
{
// ignore. we always check pending job after eval script
}
virtual LoadModuleResult onLoadModule(ContextRef* relatedContext, ScriptRef* whereRequestFrom, StringRef* moduleSrc, ModuleType type) override
{
std::string referrerPath = whereRequestFrom->src()->toStdUTF8String();
auto& loadedModules = *reinterpret_cast<std::vector<std::tuple<std::string, ContextRef*, PersistentRefHolder<ScriptRef>>>*>(threadLocalCustomData());
for (size_t i = 0; i < loadedModules.size(); i++) {
if (std::get<2>(loadedModules[i]) == whereRequestFrom) {
referrerPath = std::get<0>(loadedModules[i]);
break;
}
}
std::string absPath = absolutePath(referrerPath, moduleSrc->toStdUTF8String());
if (absPath.length() == 0) {
std::string s = "Error reading : " + moduleSrc->toStdUTF8String();
return LoadModuleResult(ErrorObjectRef::Code::None, StringRef::createFromUTF8(s.data(), s.length()));
}
for (size_t i = 0; i < loadedModules.size(); i++) {
if (std::get<0>(loadedModules[i]) == absPath && std::get<1>(loadedModules[i]) == relatedContext) {
return LoadModuleResult(std::get<2>(loadedModules[i]));
}
}
OptionalRef<StringRef> source = builtinHelperFileRead(nullptr, absPath.data(), "");
if (!source) {
std::string s = "Error reading : " + absPath;
return LoadModuleResult(ErrorObjectRef::Code::None, StringRef::createFromUTF8(s.data(), s.length()));
}
ScriptParserRef::InitializeScriptResult parseResult;
StringRef* srcName = StringRef::createFromUTF8(absPath.data(), absPath.size());
if (type == ModuleJSON) {
parseResult = relatedContext->scriptParser()->initializeJSONModule(source.value(), srcName);
} else {
parseResult = relatedContext->scriptParser()->initializeScript(source.value(), srcName, true);
}
if (!parseResult.isSuccessful()) {
return LoadModuleResult(parseResult.parseErrorCode, parseResult.parseErrorMessage);
}
return LoadModuleResult(parseResult.script.get());
}
virtual void didLoadModule(ContextRef* relatedContext, OptionalRef<ScriptRef> referrer, ScriptRef* loadedModule) override
{
std::string path;
if (referrer && loadedModule->src()->length() && loadedModule->src()->charAt(0) != '/') {
path = absolutePath(referrer->src()->toStdUTF8String(), loadedModule->src()->toStdUTF8String());
} else {
path = absolutePath(loadedModule->src()->toStdUTF8String());
}
auto& loadedModules = *reinterpret_cast<std::vector<std::tuple<std::string, ContextRef*, PersistentRefHolder<ScriptRef>>>*>(threadLocalCustomData());
loadedModules.push_back(std::make_tuple(path, relatedContext, PersistentRefHolder<ScriptRef>(loadedModule)));
}
virtual void hostImportModuleDynamically(ContextRef* relatedContext, ScriptRef* referrer, StringRef* src, ModuleType type, PromiseObjectRef* promise) override
{
LoadModuleResult loadedModuleResult = onLoadModule(relatedContext, referrer, src, type);
notifyHostImportModuleDynamicallyResult(relatedContext, referrer, src, promise, loadedModuleResult);
}
virtual bool canBlockExecution(ContextRef* relatedContext) override
{
return m_canBlock;
}
virtual void* allocateThreadLocalCustomData() override
{
return new std::vector<std::tuple<std::string /* abs path */, ContextRef*, PersistentRefHolder<ScriptRef>>>();
}
virtual void deallocateThreadLocalCustomData() override
{
delete reinterpret_cast<std::vector<std::tuple<std::string, ContextRef*, PersistentRefHolder<ScriptRef>>>*>(threadLocalCustomData());
}
private:
std::string dirnameOf(const std::string& fname)
{
size_t pos = fname.find_last_of("/");
if (std::string::npos == pos) {
pos = fname.find_last_of("\\/");
}
return (std::string::npos == pos)
? ""
: fname.substr(0, pos);
}
std::string absolutePath(const std::string& referrerPath, const std::string& src)
{
std::string utf8MayRelativePath = dirnameOf(referrerPath) + "/" + src;
auto absPath = realpath(utf8MayRelativePath.data(), nullptr);
if (!absPath) {
return std::string();
}
std::string utf8AbsolutePath = absPath;
free(absPath);
return utf8AbsolutePath;
}
std::string absolutePath(const std::string& src)
{
auto absPath = realpath(src.data(), nullptr);
if (!absPath) {
return std::string();
}
std::string utf8AbsolutePath = absPath;
free(absPath);
return utf8AbsolutePath;
}
};
extern "C"
JNIEXPORT void JNICALL
Java_com_samsung_lwe_escargot_Globals_initializeGlobals(JNIEnv* env, jclass clazz)
{
if (!Globals::isInitialized()) {
Globals::initialize(new ShellPlatform());
Memory::addGCEventListener(Memory::MARK_START, gcCallback, nullptr);
}
}
extern "C"
JNIEXPORT void JNICALL
Java_com_samsung_lwe_escargot_Globals_finalizeGlobals(JNIEnv* env, jclass clazz)
{
if (Globals::isInitialized()) {
// java object cleanup
gcCallback(nullptr);
Memory::removeGCEventListener(Memory::MARK_START, gcCallback, nullptr);
Globals::finalize();
}
}
extern "C"
JNIEXPORT void JNICALL
Java_com_samsung_lwe_escargot_Globals_initializeThread(JNIEnv* env, jclass clazz)
{
if (!Globals::isInitialized()) {
Globals::initializeThread();
}
}
extern "C"
JNIEXPORT void JNICALL
Java_com_samsung_lwe_escargot_Globals_finalizeThread(JNIEnv* env, jclass clazz)
{
if (Globals::isInitialized()) {
Globals::finalizeThread();
}
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_Globals_isInitialized(JNIEnv* env, jclass clazz)
{
return Globals::isInitialized();
}
extern "C"
JNIEXPORT jstring JNICALL
Java_com_samsung_lwe_escargot_Globals_version(JNIEnv* env, jclass clazz)
{
std::string version = Globals::version();
std::basic_string<uint16_t> u16Version;
for (auto c: version) {
u16Version.push_back(c);
}
return env->NewString(u16Version.data(), u16Version.length());
}
extern "C"
JNIEXPORT jstring JNICALL
Java_com_samsung_lwe_escargot_Globals_buildDate(JNIEnv* env, jclass clazz)
{
std::string version = Globals::buildDate();
std::basic_string<uint16_t> u16Version;
for (auto c: version) {
u16Version.push_back(c);
}
return env->NewString(u16Version.data(), u16Version.length());
}

View file

@ -0,0 +1,48 @@
/*
* Copyright (c) 2023-present Samsung Electronics Co., Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#include "EscargotJNI.h"
extern "C"
JNIEXPORT void JNICALL
Java_com_samsung_lwe_escargot_Memory_gc(JNIEnv* env, jclass clazz)
{
Memory::gc();
}
extern "C"
JNIEXPORT jlong JNICALL
Java_com_samsung_lwe_escargot_Memory_heapSize(JNIEnv* env, jclass clazz)
{
return Memory::heapSize();
}
extern "C"
JNIEXPORT jlong JNICALL
Java_com_samsung_lwe_escargot_Memory_totalSize(JNIEnv* env, jclass clazz)
{
return Memory::totalSize();
}
extern "C"
JNIEXPORT void JNICALL
Java_com_samsung_lwe_escargot_Memory_setGCFrequency(JNIEnv* env, jclass clazz, jint value)
{
Memory::setGCFrequency(value);
}

View file

@ -0,0 +1,32 @@
/*
* Copyright (c) 2023-present Samsung Electronics Co., Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#include "EscargotJNI.h"
extern "C"
JNIEXPORT void JNICALL
Java_com_samsung_lwe_escargot_NativePointerHolder_releaseNativePointerMemory(JNIEnv* env,
jclass clazz, jlong pointer)
{
uint64_t ptrInNumber = (uint64_t)(pointer);
if (ptrInNumber > g_nonPointerValueLast && !(pointer & 1)) {
PersistentRefHolder<void>* pRef = reinterpret_cast<PersistentRefHolder<void>*>(pointer);
delete pRef;
}
}

View file

@ -0,0 +1,173 @@
/*
* Copyright (c) 2023-present Samsung Electronics Co., Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#include "EscargotJNI.h"
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptObject_create(JNIEnv* env, jclass clazz, jobject context)
{
THROW_NPE_RETURN_NULL(context, "Context");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state) -> ValueRef* {
return ObjectRef::create(state);
});
assert(evaluatorResult.isSuccessful());
return createJavaObjectFromValue(env, evaluatorResult.result->asObject());
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptObject_get(JNIEnv* env, jobject thiz, jobject context,
jobject propertyName)
{
THROW_NPE_RETURN_NULL(context, "Context");
THROW_NPE_RETURN_NULL(propertyName, "JavaScriptValue");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
ObjectRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asObject();
ValueRef* propertyNameValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(propertyName), propertyName);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, ObjectRef* thisValueRef, ValueRef* propertyNameValueRef) -> ValueRef* {
return thisValueRef->get(state, propertyNameValueRef);
}, thisValueRef, propertyNameValueRef);
return createOptionalValueFromEvaluatorJavaScriptValueResult(env, context, contextRef->get(),
evaluatorResult);
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptObject_set(JNIEnv* env, jobject thiz, jobject context,
jobject propertyName, jobject value)
{
THROW_NPE_RETURN_NULL(context, "Context");
THROW_NPE_RETURN_NULL(propertyName, "JavaScriptValue");
THROW_NPE_RETURN_NULL(value, "JavaScriptValue");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
ObjectRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asObject();
ValueRef* propertyNameValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(propertyName), propertyName);
ValueRef* valueRef = unwrapValueRefFromValue(env, env->GetObjectClass(value), value);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, ObjectRef* thisValueRef, ValueRef* propertyNameValueRef, ValueRef* valueRef) -> ValueRef* {
return ValueRef::create(thisValueRef->set(state, propertyNameValueRef, valueRef));
}, thisValueRef, propertyNameValueRef, valueRef);
return createOptionalValueFromEvaluatorBooleanResult(env, context, contextRef->get(),
evaluatorResult);
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptObject_defineDataProperty(JNIEnv* env, jobject thiz,
jobject context,
jobject propertyName,
jobject value,
jboolean isWritable,
jboolean isEnumerable,
jboolean isConfigurable)
{
THROW_NPE_RETURN_NULL(context, "Context");
THROW_NPE_RETURN_NULL(propertyName, "JavaScriptValue");
THROW_NPE_RETURN_NULL(value, "JavaScriptValue");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
ObjectRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asObject();
ValueRef* propertyNameValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(propertyName), propertyName);
ValueRef* valueRef = unwrapValueRefFromValue(env, env->GetObjectClass(value), value);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, ObjectRef* thisValueRef, ValueRef* propertyNameValueRef, ValueRef* valueRef,
jboolean isWritable,
jboolean isEnumerable,
jboolean isConfigurable) -> ValueRef* {
return ValueRef::create(thisValueRef->defineDataProperty(state, propertyNameValueRef, valueRef, isWritable, isEnumerable, isConfigurable));
}, thisValueRef, propertyNameValueRef, valueRef, isWritable, isEnumerable, isConfigurable);
return createOptionalValueFromEvaluatorBooleanResult(env, context, contextRef->get(),
evaluatorResult);
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptObject_getOwnProperty(JNIEnv* env, jobject thiz,
jobject context,
jobject propertyName)
{
THROW_NPE_RETURN_NULL(context, "Context");
THROW_NPE_RETURN_NULL(propertyName, "JavaScriptValue");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
ObjectRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asObject();
ValueRef* propertyNameValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(propertyName), propertyName);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, ObjectRef* thisValueRef, ValueRef* propertyNameValueRef) -> ValueRef* {
return thisValueRef->getOwnProperty(state, propertyNameValueRef);
}, thisValueRef, propertyNameValueRef);
return createOptionalValueFromEvaluatorJavaScriptValueResult(env, context, contextRef->get(),
evaluatorResult);
}
extern "C"
JNIEXPORT void JNICALL
Java_com_samsung_lwe_escargot_JavaScriptObject_setExtraData(JNIEnv* env, jobject thiz,
jobject object)
{
ObjectRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asObject();
jobject extraData = nullptr;
if (object) {
auto classOptional = env->GetObjectClass(object);
auto methodIsPresent = env->GetMethodID(classOptional, "isPresent", "()Z");
if (env->CallBooleanMethod(object, methodIsPresent)) {
auto methodGet = env->GetMethodID(classOptional, "get", "()Ljava/lang/Object;");
jboolean isSucceed;
extraData = env->CallObjectMethod(object, methodGet);
extraData = env->NewGlobalRef(extraData);
}
}
ensureScriptObjectExtraData(thisValueRef)->userData = extraData;
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptObject_extraData(JNIEnv* env, jobject thiz)
{
ObjectRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asObject();
jobject extraData = nullptr;
if (thisValueRef->extraData()) {
extraData = ensureScriptObjectExtraData(thisValueRef)->userData;
}
jclass optionalClazz = env->FindClass("java/util/Optional");
if (extraData) {
return env->CallStaticObjectMethod(optionalClazz,
env->GetStaticMethodID(optionalClazz, "of",
"(Ljava/lang/Object;)Ljava/util/Optional;"),
extraData);
} else {
return env->CallStaticObjectMethod(optionalClazz,
env->GetStaticMethodID(optionalClazz, "empty",
"()Ljava/util/Optional;"));
}
}

View file

@ -0,0 +1,172 @@
/*
* Copyright (c) 2023-present Samsung Electronics Co., Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#include "EscargotJNI.h"
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptPromiseObject_create(JNIEnv* env, jclass clazz,
jobject context)
{
THROW_NPE_RETURN_NULL(context, "Context");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state) -> ValueRef* {
return PromiseObjectRef::create(state);
});
assert(evaluatorResult.isSuccessful());
return createJavaObjectFromValue(env, evaluatorResult.result->asPromiseObject());
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptPromiseObject_state(JNIEnv* env, jobject thiz)
{
PromiseObjectRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asPromiseObject();
jclass enumClass = env->FindClass(
"com/samsung/lwe/escargot/JavaScriptPromiseObject$PromiseState");
jfieldID enumFieldID;
PromiseObjectRef::PromiseState state = thisValueRef->state();
if (state == PromiseObjectRef::Pending) {
enumFieldID = env->GetStaticFieldID(enumClass, "Pending",
"Lcom/samsung/lwe/escargot/JavaScriptPromiseObject$PromiseState;");
} else if (state == PromiseObjectRef::FulFilled) {
enumFieldID = env->GetStaticFieldID(enumClass, "FulFilled",
"Lcom/samsung/lwe/escargot/JavaScriptPromiseObject$PromiseState;");
} else {
enumFieldID = env->GetStaticFieldID(enumClass, "Rejected",
"Lcom/samsung/lwe/escargot/JavaScriptPromiseObject$PromiseState;");
}
return env->GetStaticObjectField(enumClass, enumFieldID);
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptPromiseObject_promiseResult(JNIEnv* env, jobject thiz)
{
PromiseObjectRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asPromiseObject();
return createJavaObjectFromValue(env, thisValueRef->promiseResult());
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptPromiseObject_then__Lcom_samsung_lwe_escargot_Context_2Lcom_samsung_lwe_escargot_JavaScriptValue_2(
JNIEnv* env, jobject thiz, jobject context, jobject handler)
{
THROW_NPE_RETURN_NULL(context, "Context");
THROW_NPE_RETURN_NULL(handler, "JavaScriptValue");
PromiseObjectRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asPromiseObject();
ValueRef* handlerRef = unwrapValueRefFromValue(env, env->GetObjectClass(handler), handler);
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, PromiseObjectRef* promiseObject, ValueRef* handlerRef) -> ValueRef* {
return promiseObject->then(state, handlerRef);
}, thisValueRef, handlerRef);
return createOptionalValueFromEvaluatorJavaScriptValueResult(env, context, contextRef->get(),
evaluatorResult);
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptPromiseObject_then__Lcom_samsung_lwe_escargot_Context_2Lcom_samsung_lwe_escargot_JavaScriptValue_2Lcom_samsung_lwe_escargot_JavaScriptValue_2(
JNIEnv* env, jobject thiz, jobject context, jobject onFulfilled, jobject onRejected)
{
THROW_NPE_RETURN_NULL(context, "Context");
THROW_NPE_RETURN_NULL(onFulfilled, "JavaScriptValue");
THROW_NPE_RETURN_NULL(onRejected, "JavaScriptValue");
PromiseObjectRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asPromiseObject();
ValueRef* onFulfilledRef = unwrapValueRefFromValue(env, env->GetObjectClass(onFulfilled), onFulfilled);
ValueRef* onRejectedRef = unwrapValueRefFromValue(env, env->GetObjectClass(onRejected), onRejected);
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, PromiseObjectRef* promiseObject, ValueRef* onFulfilledRef, ValueRef* onRejectedRef) -> ValueRef* {
return promiseObject->then(state, onFulfilledRef, onRejectedRef);
}, thisValueRef, onFulfilledRef, onRejectedRef);
return createOptionalValueFromEvaluatorJavaScriptValueResult(env, context, contextRef->get(),
evaluatorResult);
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptPromiseObject_catchOperation(JNIEnv* env, jobject thiz,
jobject context,
jobject handler)
{
THROW_NPE_RETURN_NULL(context, "Context");
THROW_NPE_RETURN_NULL(handler, "JavaScriptValue");
PromiseObjectRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asPromiseObject();
ValueRef* handlerRef = unwrapValueRefFromValue(env, env->GetObjectClass(handler), handler);
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, PromiseObjectRef* promiseObject, ValueRef* handlerRef) -> ValueRef* {
return promiseObject->catchOperation(state, handlerRef);
}, thisValueRef, handlerRef);
return createOptionalValueFromEvaluatorJavaScriptValueResult(env, context, contextRef->get(),
evaluatorResult);
}
extern "C"
JNIEXPORT void JNICALL
Java_com_samsung_lwe_escargot_JavaScriptPromiseObject_fulfill(JNIEnv* env, jobject thiz,
jobject context, jobject value)
{
THROW_NPE_RETURN_VOID(context, "Context");
THROW_NPE_RETURN_VOID(value, "JavaScriptValue");
PromiseObjectRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asPromiseObject();
ValueRef* valueRef = unwrapValueRefFromValue(env, env->GetObjectClass(value), value);
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, PromiseObjectRef* promiseObject, ValueRef* valueRef) -> ValueRef* {
promiseObject->fulfill(state, valueRef);
return ValueRef::createUndefined();
}, thisValueRef, valueRef);
assert(evaluatorResult.isSuccessful());
}
extern "C"
JNIEXPORT void JNICALL
Java_com_samsung_lwe_escargot_JavaScriptPromiseObject_reject(JNIEnv* env, jobject thiz,
jobject context, jobject reason)
{
THROW_NPE_RETURN_VOID(context, "Context");
THROW_NPE_RETURN_VOID(reason, "JavaScriptValue");
PromiseObjectRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asPromiseObject();
ValueRef* reasonRef = unwrapValueRefFromValue(env, env->GetObjectClass(reason), reason);
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, PromiseObjectRef* promiseObject, ValueRef* reasonRef) -> ValueRef* {
promiseObject->reject(state, reasonRef);
return ValueRef::createUndefined();
}, thisValueRef, reasonRef);
assert(evaluatorResult.isSuccessful());
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_JavaScriptPromiseObject_hasHandler(JNIEnv* env, jobject thiz)
{
PromiseObjectRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asPromiseObject();
return thisValueRef->hasResolveHandlers() || thisValueRef->hasRejectHandlers();
}

View file

@ -0,0 +1,35 @@
/*
* Copyright (c) 2023-present Samsung Electronics Co., Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#include "EscargotJNI.h"
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptString_create(JNIEnv* env, jclass clazz, jstring value)
{
return createJavaValueObject(env, "com/samsung/lwe/escargot/JavaScriptString", createJSStringFromJava(env, value));
}
extern "C"
JNIEXPORT jstring JNICALL
Java_com_samsung_lwe_escargot_JavaScriptString_toJavaString(JNIEnv* env, jobject thiz)
{
StringRef* string = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asString();
return createJavaStringFromJS(env, string);
}

View file

@ -0,0 +1,79 @@
/*
* Copyright (c) 2023-present Samsung Electronics Co., Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#include "EscargotJNI.h"
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptSymbol_create(JNIEnv* env, jclass clazz, jobject value)
{
OptionalRef<StringRef> descString;
if (value) {
auto classOptionalJavaScriptString = env->GetObjectClass(value);
auto methodIsPresent = env->GetMethodID(classOptionalJavaScriptString, "isPresent", "()Z");
if (env->CallBooleanMethod(value, methodIsPresent)) {
auto methodGet = env->GetMethodID(classOptionalJavaScriptString, "get", "()Ljava/lang/Object;");
jboolean isSucceed;
jobject javaObjectValue = env->CallObjectMethod(value, methodGet);
descString = unwrapValueRefFromValue(env, env->GetObjectClass(javaObjectValue), javaObjectValue)->asString();
}
}
return createJavaValueObject(env, "com/samsung/lwe/escargot/JavaScriptSymbol", SymbolRef::create(descString));
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptSymbol_fromGlobalSymbolRegistry(JNIEnv* env, jclass clazz,
jobject vm,
jobject stringKey)
{
THROW_NPE_RETURN_NULL(vm, "VMInstance");
THROW_NPE_RETURN_NULL(stringKey, "JavaScriptString");
auto ptr = getPersistentPointerFromJava<VMInstanceRef>(env, env->GetObjectClass(vm), vm);
auto key = unwrapValueRefFromValue(env, env->GetObjectClass(stringKey), stringKey);
auto symbol = SymbolRef::fromGlobalSymbolRegistry(ptr->get(), key->asString());
return createJavaObjectFromValue(env, symbol);
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptSymbol_descriptionString(JNIEnv* env, jobject thiz)
{
auto desc = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asSymbol()->descriptionString();
return createJavaObjectFromValue(env, desc);
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptSymbol_descriptionValue(JNIEnv* env, jobject thiz)
{
auto desc = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asSymbol()->descriptionValue();
return createJavaObjectFromValue(env, desc);
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptSymbol_symbolDescriptiveString(JNIEnv* env, jobject thiz)
{
auto desc = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->asSymbol()->symbolDescriptiveString();
return createJavaObjectFromValue(env, desc);
}

View file

@ -0,0 +1,56 @@
/*
* Copyright (c) 2023-present Samsung Electronics Co., Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#include "EscargotJNI.h"
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_VMInstance_create(JNIEnv *env, jclass clazz, jobject locale,
jobject timezone)
{
THROW_NPE_RETURN_NULL(locale, "Optional<String>");
THROW_NPE_RETURN_NULL(timezone, "Optional<String>");
std::string localeString = fetchStringFromJavaOptionalString(env, locale);
std::string timezoneString = fetchStringFromJavaOptionalString(env, timezone);
auto vmRef = VMInstanceRef::create(localeString.length() ? localeString.data() : nullptr,
timezoneString.length() ? timezoneString.data() : nullptr);
return createJavaObject(env, vmRef.get());
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_VMInstance_hasPendingJob(JNIEnv* env, jobject thiz)
{
auto vmPtr = getPersistentPointerFromJava<VMInstanceRef>(env, env->GetObjectClass(thiz),
thiz);
return vmPtr->get()->hasPendingJob();
}
extern "C"
JNIEXPORT void JNICALL
Java_com_samsung_lwe_escargot_VMInstance_executePendingJob(JNIEnv* env, jobject thiz)
{
auto vmPtr = getPersistentPointerFromJava<VMInstanceRef>(env, env->GetObjectClass(thiz),
thiz);
if (vmPtr->get()->hasPendingJob()) {
vmPtr->get()->executePendingJob();
}
}

View file

@ -0,0 +1,500 @@
/*
* Copyright (c) 2023-present Samsung Electronics Co., Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#include "EscargotJNI.h"
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_createUndefined(JNIEnv* env, jclass clazz)
{
return createJavaValueObject(env, clazz, ValueRef::createUndefined());
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_createNull(JNIEnv* env, jclass clazz)
{
return createJavaValueObject(env, clazz, ValueRef::createNull());
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_create__I(JNIEnv* env, jclass clazz, jint value)
{
return createJavaValueObject(env, clazz, ValueRef::create(value));
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_create__D(JNIEnv* env, jclass clazz, jdouble value)
{
return createJavaValueObject(env, clazz, ValueRef::create(value));
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_create__Z(JNIEnv* env, jclass clazz, jboolean value)
{
return createJavaValueObject(env, clazz, ValueRef::create(static_cast<bool>(value)));
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_isUndefined(JNIEnv* env, jobject thiz)
{
return unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->isUndefined();
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_isNull(JNIEnv* env, jobject thiz)
{
return unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->isNull();
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_isUndefinedOrNull(JNIEnv* env, jobject thiz)
{
return unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->isUndefinedOrNull();
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_isNumber(JNIEnv* env, jobject thiz)
{
return unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->isNumber();
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_isInt32(JNIEnv* env, jobject thiz)
{
return unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->isInt32();
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_isBoolean(JNIEnv* env, jobject thiz)
{
return unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->isBoolean();
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_isTrue(JNIEnv* env, jobject thiz)
{
return unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->isTrue();
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_isFalse(JNIEnv* env, jobject thiz)
{
return unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->isFalse();
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_isString(JNIEnv* env, jobject thiz)
{
return unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->isString();
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_isSymbol(JNIEnv* env, jobject thiz)
{
return unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->isSymbol();
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_isBigInt(JNIEnv* env, jobject thiz)
{
return unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->isBigInt();
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_isCallable(JNIEnv* env, jobject thiz)
{
return unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->isCallable();
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_isObject(JNIEnv* env, jobject thiz)
{
return unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->isObject();
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_isArrayObject(JNIEnv* env, jobject thiz)
{
return unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->isArrayObject();
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_isFunctionObject(JNIEnv* env, jobject thiz)
{
return unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->isFunctionObject();
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_isPromiseObject(JNIEnv* env, jobject thiz)
{
return unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->isPromiseObject();
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_isErrorObject(JNIEnv* env, jobject thiz)
{
return unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz)->isErrorObject();
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_asBoolean(JNIEnv* env, jobject thiz)
{
ValueRef* ref = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz);
THROW_CAST_EXCEPTION_IF_NEEDS(env, ref, Boolean);
return ref->asBoolean();
}
extern "C"
JNIEXPORT jint JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_asInt32(JNIEnv* env, jobject thiz)
{
ValueRef* ref = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz);
THROW_CAST_EXCEPTION_IF_NEEDS(env, ref, Int32);
return ref->asInt32();
}
extern "C"
JNIEXPORT jdouble JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_asNumber(JNIEnv* env, jobject thiz)
{
ValueRef* ref = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz);
THROW_CAST_EXCEPTION_IF_NEEDS(env, ref, Number);
return ref->asNumber();
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_asScriptString(JNIEnv* env, jobject thiz)
{
ValueRef* ref = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz);
THROW_CAST_EXCEPTION_IF_NEEDS(env, ref, String);
return thiz;
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_asScriptSymbol(JNIEnv* env, jobject thiz)
{
ValueRef* ref = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz);
THROW_CAST_EXCEPTION_IF_NEEDS(env, ref, Symbol);
return thiz;
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_asScriptBigInt(JNIEnv* env, jobject thiz)
{
ValueRef* ref = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz);
THROW_CAST_EXCEPTION_IF_NEEDS(env, ref, BigInt);
return thiz;
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_asScriptObject(JNIEnv* env, jobject thiz)
{
ValueRef* ref = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz);
THROW_CAST_EXCEPTION_IF_NEEDS(env, ref, Object);
return thiz;
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_asScriptArrayObject(JNIEnv* env, jobject thiz)
{
ValueRef* ref = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz);
THROW_CAST_EXCEPTION_IF_NEEDS(env, ref, ArrayObject);
return thiz;
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_asScriptFunctionObject(JNIEnv* env, jobject thiz)
{
ValueRef* ref = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz);
THROW_CAST_EXCEPTION_IF_NEEDS(env, ref, FunctionObject);
return thiz;
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_asScriptPromiseObject(JNIEnv* env, jobject thiz)
{
ValueRef* ref = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz);
THROW_CAST_EXCEPTION_IF_NEEDS(env, ref, PromiseObject);
return thiz;
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_asScriptErrorObject(JNIEnv* env, jobject thiz)
{
ValueRef* ref = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz);
THROW_CAST_EXCEPTION_IF_NEEDS(env, ref, ErrorObject);
return thiz;
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_toString(JNIEnv* env, jobject thiz, jobject context)
{
THROW_NPE_RETURN_NULL(context, "Context");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
ValueRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, ValueRef* thisValueRef) -> ValueRef* {
return thisValueRef->toString(state);
}, thisValueRef);
return createOptionalValueFromEvaluatorJavaScriptValueResult(env, context, contextRef->get(),
evaluatorResult);
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_toNumber(JNIEnv* env, jobject thiz, jobject context)
{
THROW_NPE_RETURN_NULL(context, "Context");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
ValueRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, ValueRef* thisValueRef) -> ValueRef* {
return ValueRef::create(thisValueRef->toNumber(state));
}, thisValueRef);
return createOptionalValueFromEvaluatorDoubleResult(env, context, contextRef->get(),
evaluatorResult);
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_toInteger(JNIEnv* env, jobject thiz, jobject context)
{
THROW_NPE_RETURN_NULL(context, "Context");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
ValueRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, ValueRef* thisValueRef) -> ValueRef* {
return ValueRef::create(thisValueRef->toInteger(state));
}, thisValueRef);
return createOptionalValueFromEvaluatorDoubleResult(env, context, contextRef->get(),
evaluatorResult);
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_toInt32(JNIEnv* env, jobject thiz, jobject context)
{
THROW_NPE_RETURN_NULL(context, "Context");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
ValueRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, ValueRef* thisValueRef) -> ValueRef* {
return ValueRef::create(thisValueRef->toInt32(state));
}, thisValueRef);
return createOptionalValueFromEvaluatorIntegerResult(env, context, contextRef->get(),
evaluatorResult);
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_toBoolean(JNIEnv* env, jobject thiz, jobject context)
{
THROW_NPE_RETURN_NULL(context, "Context");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
ValueRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, ValueRef* thisValueRef) -> ValueRef* {
return ValueRef::create(thisValueRef->toBoolean(state));
}, thisValueRef);
return createOptionalValueFromEvaluatorBooleanResult(env, context, contextRef->get(),
evaluatorResult);
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_toObject(JNIEnv* env, jobject thiz, jobject context)
{
THROW_NPE_RETURN_NULL(context, "Context");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
ValueRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, ValueRef* thisValueRef) -> ValueRef* {
return thisValueRef->toObject(state);
}, thisValueRef);
return createOptionalValueFromEvaluatorJavaScriptValueResult(env, context, contextRef->get(),
evaluatorResult);
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_abstractEqualsTo(JNIEnv* env, jobject thiz,
jobject context, jobject other)
{
THROW_NPE_RETURN_NULL(context, "Context");
THROW_NPE_RETURN_NULL(other, "JavaScriptValue");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
ValueRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz);
ValueRef* otherValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(other), other);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, ValueRef* thisValueRef, ValueRef* otherValueRef) -> ValueRef* {
return ValueRef::create(thisValueRef->abstractEqualsTo(state, otherValueRef));
}, thisValueRef, otherValueRef);
return createOptionalValueFromEvaluatorBooleanResult(env, context, contextRef->get(),
evaluatorResult);
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_equalsTo(JNIEnv* env, jobject thiz, jobject context,
jobject other)
{
THROW_NPE_RETURN_NULL(context, "Context");
THROW_NPE_RETURN_NULL(other, "JavaScriptValue");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
ValueRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz);
ValueRef* otherValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(other), other);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, ValueRef* thisValueRef, ValueRef* otherValueRef) -> ValueRef* {
return ValueRef::create(thisValueRef->equalsTo(state, otherValueRef));
}, thisValueRef, otherValueRef);
return createOptionalValueFromEvaluatorBooleanResult(env, context, contextRef->get(),
evaluatorResult);
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_instanceOf(JNIEnv* env, jobject thiz, jobject context,
jobject other)
{
THROW_NPE_RETURN_NULL(context, "Context");
THROW_NPE_RETURN_NULL(other, "JavaScriptValue");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
ValueRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz);
ValueRef* otherValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(other), other);
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(), [](ExecutionStateRef* state, ValueRef* thisValueRef, ValueRef* otherValueRef) -> ValueRef* {
return ValueRef::create(thisValueRef->instanceOf(state, otherValueRef));
}, thisValueRef, otherValueRef);
return createOptionalValueFromEvaluatorBooleanResult(env, context, contextRef->get(),
evaluatorResult);
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_call(JNIEnv* env, jobject thiz, jobject context,
jobject receiver, jobjectArray argv)
{
THROW_NPE_RETURN_NULL(context, "Context");
THROW_NPE_RETURN_NULL(receiver, "JavaScriptValue");
THROW_NPE_RETURN_NULL(argv, "JavaScriptValue[]");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
ValueRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz);
ValueRef* receiverValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(receiver), receiver);
auto argvLength = env->GetArrayLength(argv);
ValueRef** argVector = reinterpret_cast<ValueRef**>(Memory::gcMalloc(argvLength * sizeof(ValueRef*)));
for (jsize i = 0; i < argvLength; i++) {
jobject e = env->GetObjectArrayElement(argv, i);
argVector[i] = unwrapValueRefFromValue(env, env->GetObjectClass(e), e);
env->DeleteLocalRef(e);
}
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(),
[](ExecutionStateRef* state, ValueRef* thisValueRef, ValueRef* receiverValueRef, ValueRef** argVector, int argvLength) -> ValueRef* {
return thisValueRef->call(state, receiverValueRef, argvLength, argVector);
}, thisValueRef, receiverValueRef, argVector, argvLength);
Memory::gcFree(argVector);
return createOptionalValueFromEvaluatorJavaScriptValueResult(env, context, contextRef->get(),
evaluatorResult);
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_samsung_lwe_escargot_JavaScriptValue_construct(JNIEnv* env, jobject thiz, jobject context,
jobjectArray argv)
{
THROW_NPE_RETURN_NULL(context, "Context");
THROW_NPE_RETURN_NULL(argv, "JavaScriptValue[]");
auto contextRef = getPersistentPointerFromJava<ContextRef>(env, env->GetObjectClass(context), context);
ValueRef* thisValueRef = unwrapValueRefFromValue(env, env->GetObjectClass(thiz), thiz);
auto argvLength = env->GetArrayLength(argv);
ValueRef** argVector = reinterpret_cast<ValueRef**>(Memory::gcMalloc(argvLength * sizeof(ValueRef*)));
for (jsize i = 0; i < argvLength; i++) {
jobject e = env->GetObjectArrayElement(argv, i);
argVector[i] = unwrapValueRefFromValue(env, env->GetObjectClass(e), e);
env->DeleteLocalRef(e);
}
auto evaluatorResult = ScriptEvaluator::execute(contextRef->get(),
[](ExecutionStateRef* state, ValueRef* thisValueRef, ValueRef** argVector, int argvLength) -> ValueRef* {
return thisValueRef->construct(state, argvLength, argVector);
}, thisValueRef, argVector, argvLength);
Memory::gcFree(argVector);
return createOptionalValueFromEvaluatorJavaScriptValueResult(env, context, contextRef->get(),
evaluatorResult);
}

View file

@ -0,0 +1,29 @@
package com.samsung.lwe.escargot;
import java.util.Optional;
final public class Bridge {
static { Escargot.init(); }
private Bridge() {
}
public abstract static class Adapter {
/**
* @param context Context from callee
* @param data the data parameter contains value when call this function from JavaScript
* @return if want to return data to JavaScript callback, you can return value from this callback.
*/
public abstract Optional<JavaScriptValue> callback(Context context, Optional<JavaScriptValue> data);
}
/**
* if success, you can access `GlobalObject`.`objectName`.`propertyName`(...) in JavaScript
*
* @param context
* @param objectName
* @param propertyName
* @param adapter
* @return returns true if success
*/
static public native boolean register(Context context, String objectName, String propertyName, Adapter adapter);
}

View file

@ -0,0 +1,25 @@
package com.samsung.lwe.escargot;
import java.util.Optional;
public class Context extends NativePointerHolder {
protected Context(long nativePointer)
{
super(nativePointer, true);
}
public native static Context create(VMInstance vmInstance);
public boolean exceptionWasThrown()
{
return m_lastThrownException.isPresent();
}
public Optional<JavaScriptValue> lastThrownException()
{
Optional<JavaScriptValue> lastThrownException = m_lastThrownException;
m_lastThrownException = Optional.empty();
return lastThrownException;
}
public native JavaScriptGlobalObject getGlobalObject();
public native boolean throwException(JavaScriptValue exception);
protected Optional<JavaScriptValue> m_lastThrownException = Optional.empty();
}

View file

@ -0,0 +1,50 @@
package com.samsung.lwe.escargot;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Optional;
public class Escargot {
static {
try {
System.loadLibrary("escargot-jni");
} catch(UnsatisfiedLinkError e) {
// try to load library from jar resource
Optional<String> r = copyStreamAsTempFile(Escargot.class.getResourceAsStream("/libescargot-jni.so"),
"libescargot-jni-", ".so", true);
if (r.isPresent()) {
System.load(r.get());
} else {
throw e;
}
}
}
static public Optional<String> copyStreamAsTempFile(InputStream is, String prefix, String suffix, boolean isExecutable)
{
try {
File f = File.createTempFile(prefix, suffix);
f.deleteOnExit();
f.setExecutable(isExecutable);
FileOutputStream fos = new FileOutputStream(f);
int read;
byte[] bytes = new byte[1024];
while ((read = is.read(bytes)) != -1) {
fos.write(bytes, 0, read);
}
fos.flush();
is.close();
fos.close();
return Optional.of(f.getAbsolutePath());
} catch (Exception e) {
e.printStackTrace();
}
return Optional.empty();
}
static native public void init();
}

View file

@ -0,0 +1,46 @@
package com.samsung.lwe.escargot;
import java.util.Optional;
final public class Evaluator {
static { Escargot.init(); }
private Evaluator() {
}
/**
*
* @param context
* @param source
* @param sourceFileName
* @return return result if eval was successful
*/
static public Optional<JavaScriptValue> evalScript(Context context, String source, String sourceFileName)
{
return evalScript(context, source, sourceFileName, false);
}
/**
* @param context
* @param source
* @param sourceFileName
* @param shouldPrintScriptResult
* @return return result if eval was successful
*/
static public Optional<JavaScriptValue> evalScript(Context context, String source, String sourceFileName,
boolean shouldPrintScriptResult)
{
return evalScript(context, source, sourceFileName, shouldPrintScriptResult, true);
}
/**
* @param context
* @param source
* @param sourceFileName
* @param shouldPrintScriptResult
* @param shouldExecutePendingJobsAtEnd
* @return return result if eval was successful
*/
static native public Optional<JavaScriptValue> evalScript(Context context, String source, String sourceFileName,
boolean shouldPrintScriptResult, boolean shouldExecutePendingJobsAtEnd);
}

View file

@ -0,0 +1,18 @@
package com.samsung.lwe.escargot;
final public class Globals {
private Globals() {
}
static { Escargot.init(); }
static public native void initializeGlobals();
static public native void finalizeGlobals();
static public native void initializeThread();
static public native void finalizeThread();
static public native boolean isInitialized();
static public native String version();
static public native String buildDate();
}

View file

@ -0,0 +1,31 @@
package com.samsung.lwe.escargot;
import java.util.Optional;
public class JavaScriptArrayObject extends JavaScriptObject {
protected JavaScriptArrayObject(long nativePointer)
{
super(nativePointer);
}
static public native JavaScriptArrayObject create(Context context);
/**
*
* @param context
* @param from
* @return
*/
static public Optional<JavaScriptArrayObject> create(Context context, JavaScriptValue[] from)
{
JavaScriptArrayObject ret = JavaScriptArrayObject.create(context);
ret.setLength(context, from.length);
for (int i = 0; i < from.length; i ++) {
Optional<Boolean> b = ret.set(context, JavaScriptValue.create(i), from[i]);
if (!b.isPresent() || !b.get())
return Optional.empty();
}
return Optional.of(ret);
}
public native long length(Context context);
public native void setLength(Context context, long newLength);
}

View file

@ -0,0 +1,39 @@
package com.samsung.lwe.escargot;
import java.util.Optional;
public class JavaScriptBigInt extends JavaScriptValue {
protected JavaScriptBigInt(long nativePointer)
{
super(nativePointer, true);
}
static public native JavaScriptBigInt create(int num);
static public native JavaScriptBigInt create(long num);
/**
*
* @param numString
* @param radix
* @return
*/
static public native JavaScriptBigInt create(String numString, int radix);
/**
*
* @param numString
* @param radix
* @return
*/
static public native JavaScriptBigInt create(JavaScriptString numString, int radix);
/**
*
* @param radix
* @return
*/
public native JavaScriptString toString(int radix);
public native double toNumber();
public native long toInt64();
}

View file

@ -0,0 +1,23 @@
package com.samsung.lwe.escargot;
import java.util.Optional;
public class JavaScriptErrorObject extends JavaScriptObject {
protected JavaScriptErrorObject(long nativePointer)
{
super(nativePointer);
}
public enum ErrorKind {
None,
ReferenceError,
TypeError,
SyntaxError,
RangeError,
URIError,
EvalError,
AggregateError
}
static public native JavaScriptErrorObject create(Context context, ErrorKind kind, String message);
public native Optional<JavaScriptString> stack(Context context);
}

View file

@ -0,0 +1,9 @@
package com.samsung.lwe.escargot;
public class JavaScriptFunctionObject extends JavaScriptObject {
protected JavaScriptFunctionObject(long nativePointer)
{
super(nativePointer);
}
public native Context context();
}

View file

@ -0,0 +1,73 @@
package com.samsung.lwe.escargot;
import java.util.Optional;
public class JavaScriptGlobalObject extends JavaScriptObject {
protected JavaScriptGlobalObject(long nativePointer)
{
super(nativePointer);
}
/**
*
* @param context
* @param input
* @return
*/
public native Optional<JavaScriptString> jsonStringify(Context context, JavaScriptValue input);
/**
*
* @param context
* @param input
* @return
*/
public native Optional<JavaScriptValue> jsonParse(Context context, JavaScriptValue input);
/**
*
* @param context
* @param iterable
* @return
*/
public native Optional<JavaScriptValue> promiseAll(Context context, JavaScriptValue iterable);
/**
*
* @param context
* @param iterable
* @return
*/
public native Optional<JavaScriptValue> promiseAllSettled(Context context, JavaScriptValue iterable);
/**
*
* @param context
* @param iterable
* @return
*/
public native Optional<JavaScriptValue> promiseAny(Context context, JavaScriptValue iterable);
/**
*
* @param context
* @param iterable
* @return
*/
public native Optional<JavaScriptValue> promiseRace(Context context, JavaScriptValue iterable);
/**
*
* @param context
* @param iterable
* @return
*/
public native Optional<JavaScriptValue> promiseReject(Context context, JavaScriptValue iterable);
/**
*
* @param context
* @param iterable
* @return
*/
public native Optional<JavaScriptValue> promiseResolve(Context context, JavaScriptValue iterable);
}

View file

@ -0,0 +1,32 @@
package com.samsung.lwe.escargot;
import java.util.Optional;
public class JavaScriptJavaCallbackFunctionObject extends JavaScriptFunctionObject {
protected JavaScriptJavaCallbackFunctionObject(long nativePointer)
{
super(nativePointer);
}
public abstract static class Callback {
/**
*
* @param context
* @param receiverValue
* @param arguments
* @return
*/
public abstract Optional<JavaScriptValue> callback(Context context, JavaScriptValue receiverValue, JavaScriptValue arguments[]);
}
/**
*
* @param context
* @param functionName
* @param argumentCount
* @param isConstructor
* @param callback
* @return
*/
static public native JavaScriptJavaCallbackFunctionObject create(Context context, String functionName, int argumentCount, boolean isConstructor, Callback callback);
}

Some files were not shown because too many files have changed in this diff Show more