Commit graph

147 commits

Author SHA1 Message Date
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
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
ef7441c412 Improve String hasher
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-06-18 17:50:07 +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
4a952115d0 Remove unnecessary strlen and memory copys
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2025-05-07 11:11:38 +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
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
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
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
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
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
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
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
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
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
4d884e66c6 Remove duplicated code in ScriptParser
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2023-03-28 16:17:00 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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