Skip to content

Commit

Permalink
Implement Direct {Import, Export} (#448)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
ksh8281 authored and clover2123 committed Oct 7, 2019
1 parent 89bb5e4 commit eceffac
Show file tree
Hide file tree
Showing 63 changed files with 2,665 additions and 459 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Expand Up @@ -15,8 +15,6 @@ SET (ESCARGOT_ASAN "0" CACHE STRING "ESCARGOT_ASAN")

SET (ESCARGOT_TARGET escargot)

SET (VENDORTEST FALSE CACHE BOOL "VENDORTEST")

INCLUDE (ProcessorCount)
PROCESSORCOUNT (NPROCS)

Expand Down
12 changes: 6 additions & 6 deletions Jenkinsfile
Expand Up @@ -51,8 +51,8 @@ timeout(60) {
}

stage('Prepare build(clang)') {
sh 'CC=clang-6.0 CXX=clang++-6.0 LDFLAGS=" -L/usr/icu32/lib/ -Wl,-rpath=/usr/icu32/lib/" cmake -H./ -Bbuild/out_linux_clang -DESCARGOT_HOST=linux -DESCARGOT_ARCH=x86 -DESCARGOT_MODE=debug -DESCARGOT_OUTPUT=bin -DVENDORTEST=1 -GNinja'
sh 'CC=clang-6.0 CXX=clang++-6.0 cmake -H./ -Bbuild/out_linux64_clang -DESCARGOT_HOST=linux -DESCARGOT_ARCH=x64 -DESCARGOT_MODE=debug -DESCARGOT_OUTPUT=bin -DVENDORTEST=1 -GNinja'
sh 'CC=clang-6.0 CXX=clang++-6.0 LDFLAGS=" -L/usr/icu32/lib/ -Wl,-rpath=/usr/icu32/lib/" cmake -H./ -Bbuild/out_linux_clang -DESCARGOT_HOST=linux -DESCARGOT_ARCH=x86 -DESCARGOT_MODE=debug -DESCARGOT_OUTPUT=shell_test -GNinja'
sh 'CC=clang-6.0 CXX=clang++-6.0 cmake -H./ -Bbuild/out_linux64_clang -DESCARGOT_HOST=linux -DESCARGOT_ARCH=x64 -DESCARGOT_MODE=debug -DESCARGOT_OUTPUT=shell_test -GNinja'
}

stage('Build(clang)') {
Expand All @@ -63,13 +63,13 @@ timeout(60) {
stage('Prepare build(gcc)') {
parallel (
'32bit' : {
sh 'LDFLAGS=" -L/usr/icu32/lib/ -Wl,-rpath=/usr/icu32/lib/" cmake -H./ -Bbuild/out_linux -DESCARGOT_HOST=linux -DESCARGOT_ARCH=x86 -DESCARGOT_MODE=debug -DESCARGOT_OUTPUT=bin -DVENDORTEST=1 -GNinja'
sh 'LDFLAGS=" -L/usr/icu32/lib/ -Wl,-rpath=/usr/icu32/lib/" cmake -H./ -Bbuild/out_linux_release -DESCARGOT_HOST=linux -DESCARGOT_ARCH=x86 -DESCARGOT_MODE=release -DESCARGOT_OUTPUT=bin -DVENDORTEST=1 -GNinja'
sh 'LDFLAGS=" -L/usr/icu32/lib/ -Wl,-rpath=/usr/icu32/lib/" cmake -H./ -Bbuild/out_linux -DESCARGOT_HOST=linux -DESCARGOT_ARCH=x86 -DESCARGOT_MODE=debug -DESCARGOT_OUTPUT=shell_test -GNinja'
sh 'LDFLAGS=" -L/usr/icu32/lib/ -Wl,-rpath=/usr/icu32/lib/" cmake -H./ -Bbuild/out_linux_release -DESCARGOT_HOST=linux -DESCARGOT_ARCH=x86 -DESCARGOT_MODE=release -DESCARGOT_OUTPUT=shell_test -GNinja'
sh 'gcc -shared -m32 -fPIC -o backtrace-hooking-32.so tools/test/test262/backtrace-hooking.c'
},
'64bit' : {
sh 'cmake -H./ -Bbuild/out_linux64 -DESCARGOT_HOST=linux -DESCARGOT_ARCH=x64 -DESCARGOT_MODE=debug -DESCARGOT_OUTPUT=bin -DVENDORTEST=1 -GNinja'
sh 'cmake -H./ -Bbuild/out_linux64_release -DESCARGOT_HOST=linux -DESCARGOT_ARCH=x64 -DESCARGOT_MODE=release -DESCARGOT_OUTPUT=bin -DVENDORTEST=1 -GNinja'
sh 'cmake -H./ -Bbuild/out_linux64 -DESCARGOT_HOST=linux -DESCARGOT_ARCH=x64 -DESCARGOT_MODE=debug -DESCARGOT_OUTPUT=shell_test -GNinja'
sh 'cmake -H./ -Bbuild/out_linux64_release -DESCARGOT_HOST=linux -DESCARGOT_ARCH=x64 -DESCARGOT_MODE=release -DESCARGOT_OUTPUT=shell_test -GNinja'
sh 'gcc -shared -fPIC -o backtrace-hooking-64.so tools/test/test262/backtrace-hooking.c'
}
)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -37,7 +37,7 @@ export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"
git clone https://github.com/Samsung/escargot.git
cd escargot
git submodule update --init third_party
cmake -DESCARGOT_HOST=linux -DESCARGOT_ARCH=x64 -DESCARGOT_MODE=release -DESCARGOT_OUTPUT=bin -GNinja
cmake -DESCARGOT_HOST=linux -DESCARGOT_ARCH=x64 -DESCARGOT_MODE=release -DESCARGOT_OUTPUT=shell -GNinja
ninja
```

Expand All @@ -51,7 +51,7 @@ The following build options are supported when generating ninja rules using cmak
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>
* -DESCARGOT_OUTPUT=[ shared_lib | static_lib | shell | shell_test ]<br>
Define target output type
* -DESCARGOT_LIBICU_SUPPORT=[ ON | OFF ]<br>
Enable libicu library if set ON. (Optional, default = ON)
Expand Down
10 changes: 2 additions & 8 deletions build/config.cmake
Expand Up @@ -18,7 +18,7 @@ SET (GCUTIL_ROOT ${ESCARGOT_THIRD_PARTY_ROOT}/GCutil)

SET (ESCARGOT_OUTDIR ${ESCARGOT_ROOT}/out/${ESCARGOT_HOST}/${ESCARGOT_ARCH}/${ESCARGOT_TYPE}/${ESCARGOT_MODE})

IF (ESCARGOT_OUTPUT STREQUAL "bin")
IF (ESCARGOT_OUTPUT MATCHES "shell")
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ESCARGOT_OUTDIR}/)
SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${ESCARGOT_OUTDIR}/lib)
SET (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${ESCARGOT_OUTDIR}/lib)
Expand Down Expand Up @@ -134,12 +134,6 @@ SET (ESCARGOT_CXXFLAGS_RELEASE -O2 -fno-stack-protector ${ESCARGOT_CXXFLAGS_RELE
SET (ESCARGOT_DEFINITIONS_RELEASE -DNDEBUG)


#######################################################
# FLAGS FOR $(ESCARGOT_OUTPUT) : bin/shared_lib/static_lib
#######################################################
SET (ESCARGOT_DEFINITIONS_BIN -DESCARGOT_STANDALONE -DESCARGOT_SHELL)


# SHARED_LIB FLAGS
SET (ESCARGOT_CXXFLAGS_SHAREDLIB -fPIC)
SET (ESCARGOT_LDFLAGS_SHAREDLIB -ldl)
Expand All @@ -153,7 +147,7 @@ SET (ESCARGOT_LDFLAGS_STATICLIB -Wl,--gc-sections)
#######################################################
# FLAGS FOR TEST
#######################################################
SET (ESCARGOT_DEFINITIONS_VENDORTEST -DESCARGOT_ENABLE_VENDORTEST)
SET (ESCARGOT_DEFINITIONS_TEST -DESCARGOT_ENABLE_TEST)


#######################################################
Expand Down
22 changes: 11 additions & 11 deletions build/escargot.cmake
Expand Up @@ -21,10 +21,14 @@ ELSEIF (${ESCARGOT_MODE} STREQUAL "release")
SET (ESCARGOT_DEFINITIONS ${ESCARGOT_DEFINITIONS} ${ESCARGOT_DEFINITIONS_RELEASE})
ENDIF()

IF (${ESCARGOT_OUTPUT} STREQUAL "bin")
SET (ESCARGOT_CXXFLAGS ${ESCARGOT_CXXFLAGS} ${ESCARGOT_CXXFLAGS_BIN})
SET (ESCARGOT_LDFLAGS ${ESCARGOT_LDFLAGS} ${ESCARGOT_LDFLAGS_BIN})
SET (ESCARGOT_DEFINITIONS ${ESCARGOT_DEFINITIONS} ${ESCARGOT_DEFINITIONS_BIN})
IF (${ESCARGOT_OUTPUT} STREQUAL "shell")
SET (ESCARGOT_CXXFLAGS ${ESCARGOT_CXXFLAGS} ${ESCARGOT_CXXFLAGS_SHELL})
SET (ESCARGOT_LDFLAGS ${ESCARGOT_LDFLAGS} ${ESCARGOT_LDFLAGS_SHELL})
SET (ESCARGOT_DEFINITIONS ${ESCARGOT_DEFINITIONS} ${ESCARGOT_DEFINITIONS_SHELL})
ELSEIF (${ESCARGOT_OUTPUT} STREQUAL "shell_test")
SET (ESCARGOT_CXXFLAGS ${ESCARGOT_CXXFLAGS} ${ESCARGOT_CXXFLAGS_SHELL} ${ESCARGOT_DEFINITIONS_TEST})
SET (ESCARGOT_LDFLAGS ${ESCARGOT_LDFLAGS} ${ESCARGOT_LDFLAGS_SHELL})
SET (ESCARGOT_DEFINITIONS ${ESCARGOT_DEFINITIONS} ${ESCARGOT_DEFINITIONS_SHELL})
ELSEIF (${ESCARGOT_OUTPUT} STREQUAL "shared_lib")
SET (ESCARGOT_CXXFLAGS ${ESCARGOT_CXXFLAGS} ${ESCARGOT_CXXFLAGS_SHAREDLIB})
SET (ESCARGOT_LDFLAGS ${ESCARGOT_LDFLAGS} ${ESCARGOT_LDFLAGS_SHAREDLIB})
Expand All @@ -35,10 +39,6 @@ ELSEIF (${ESCARGOT_OUTPUT} STREQUAL "static_lib")
SET (ESCARGOT_DEFINITIONS ${ESCARGOT_DEFINITIONS} ${ESCARGOT_DEFINITIONS_STATICLIB})
ENDIF()

IF (${VENDORTEST})
SET (ESCARGOT_DEFINITIONS ${ESCARGOT_DEFINITIONS} ${ESCARGOT_DEFINITIONS_VENDORTEST})
ENDIF()

IF (${ESCARGOT_ASAN} STREQUAL "1")
SET (ESCARGOT_CXXFLAGS ${ESCARGOT_CXXFLAGS} -fsanitize=address)
SET (ESCARGOT_LDFLAGS ${ESCARGOT_LDFLAGS} -lasan)
Expand All @@ -51,8 +51,8 @@ FILE (GLOB_RECURSE ESCARGOT_SRC ${ESCARGOT_ROOT}/src/*.cpp)
FILE (GLOB YARR_SRC ${ESCARGOT_THIRD_PARTY_ROOT}/yarr/*.cpp)
FILE (GLOB DOUBLE_CONVERSION_SRC ${ESCARGOT_THIRD_PARTY_ROOT}/double_conversion/*.cc)

IF (NOT ${ESCARGOT_OUTPUT} STREQUAL "bin")
LIST (REMOVE_ITEM ESCARGOT_SRC ${ESCARGOT_ROOT}/src/shell/Shell.cpp ${ESCARGOT_ROOT}/src/shell/GlobalObjectBuiltinTestFunctions.cpp)
IF (NOT ${ESCARGOT_OUTPUT} MATCHES "shell")
LIST (REMOVE_ITEM ESCARGOT_SRC ${ESCARGOT_ROOT}/src/shell/Shell.cpp)
ENDIF()

SET (ESCARGOT_SRC_LIST
Expand Down Expand Up @@ -87,7 +87,7 @@ SET (ESCARGOT_LIBRARIES ${ESCARGOT_LIBRARIES} gc-lib)


# BUILD
IF (${ESCARGOT_OUTPUT} STREQUAL "bin")
IF (${ESCARGOT_OUTPUT} MATCHES "shell")
ADD_EXECUTABLE (${ESCARGOT_TARGET} ${ESCARGOT_SRC_LIST})

TARGET_LINK_LIBRARIES (${ESCARGOT_TARGET} ${ESCARGOT_LIBRARIES} ${ESCARGOT_LDFLAGS} ${LDFLAGS_FROM_ENV})
Expand Down
2 changes: 1 addition & 1 deletion src/Escargot.h
Expand Up @@ -228,7 +228,7 @@ typedef int32_t UChar32;
#define ESCARGOT_LOG_ERROR(...) __android_log_print(ANDROID_LOG_ERROR, "Escargot", __VA_ARGS__);
#endif

#if defined(ESCARGOT_TIZEN) && !defined(ESCARGOT_STANDALONE)
#if defined(ESCARGOT_TIZEN)
#include <dlog/dlog.h>
#undef ESCARGOT_LOG_INFO
#undef ESCARGOT_LOG_ERROR
Expand Down
76 changes: 67 additions & 9 deletions src/api/EscargotPublic.cpp
Expand Up @@ -56,12 +56,10 @@ namespace Escargot {
#define DEFINE_CAST(ClassName) \
inline ClassName* toImpl(ClassName##Ref* v) \
{ \
ASSERT(v != nullptr); \
return reinterpret_cast<ClassName*>(v); \
} \
inline ClassName##Ref* toRef(ClassName* v) \
{ \
ASSERT(v != nullptr); \
return reinterpret_cast<ClassName##Ref*>(v); \
}

Expand Down Expand Up @@ -493,21 +491,47 @@ class PlatformBridge : public Platform {
{
}

virtual void* arrayBufferObjectDataBufferMallocCallback(Context* whereObjectMade, ArrayBufferObject* obj, size_t sizeInByte)
virtual void* onArrayBufferObjectDataBufferMalloc(Context* whereObjectMade, ArrayBufferObject* obj, size_t sizeInByte) override
{
return m_platform->arrayBufferObjectDataBufferMallocCallback(toRef(whereObjectMade), toRef(obj), sizeInByte);
return m_platform->onArrayBufferObjectDataBufferMalloc(toRef(whereObjectMade), toRef(obj), sizeInByte);
}

virtual void arrayBufferObjectDataBufferFreeCallback(Context* whereObjectMade, ArrayBufferObject* obj, void* buffer)
virtual void onArrayBufferObjectDataBufferFree(Context* whereObjectMade, ArrayBufferObject* obj, void* buffer) override
{
m_platform->arrayBufferObjectDataBufferFreeCallback(toRef(whereObjectMade), toRef(obj), buffer);
m_platform->onArrayBufferObjectDataBufferFree(toRef(whereObjectMade), toRef(obj), buffer);
}

virtual void didPromiseJobEnqueued(Context* relatedContext, PromiseObject* obj)
virtual void didPromiseJobEnqueued(Context* relatedContext, PromiseObject* obj) override
{
m_platform->didPromiseJobEnqueued(toRef(relatedContext), toRef(obj));
}

virtual void willLoadModuleWhenScriptExecuted(Context* relatedContext, Script* whereRequestFrom, String* moduleSrc) override
{
m_platform->willLoadModuleWhenScriptExecuted(toRef(relatedContext), toRef(whereRequestFrom), toRef(moduleSrc));
}

virtual LoadModuleResult onLoadModule(Context* relatedContext, Script* whereRequestFrom, String* moduleSrc) override
{
LoadModuleResult result;
auto refResult = m_platform->onLoadModule(toRef(relatedContext), toRef(whereRequestFrom), toRef(moduleSrc));

result.script = toImpl(refResult.script.get());
result.errorMessage = toImpl(refResult.errorMessage);
result.errorCode = refResult.errorCode;

return result;
}

virtual void didLoadModule(Context* relatedContext, Optional<Script*> whereRequestFrom, Script* loadedModule) override
{
if (whereRequestFrom) {
m_platform->didLoadModule(toRef(relatedContext), toRef(whereRequestFrom.value()), toRef(loadedModule));
} else {
m_platform->didLoadModule(toRef(relatedContext), nullptr, toRef(loadedModule));
}
}

PlatformRef* m_platform;
};

Expand Down Expand Up @@ -2215,9 +2239,9 @@ ScriptRef* ScriptParserRef::InitializeScriptResult::fetchScriptThrowsExceptionIf
return script.value();
}

ScriptParserRef::InitializeScriptResult ScriptParserRef::initializeScript(StringRef* script, StringRef* fileName)
ScriptParserRef::InitializeScriptResult ScriptParserRef::initializeScript(StringRef* script, StringRef* fileName, bool isModule)
{
auto internalResult = toImpl(this)->initializeScript(toImpl(script), toImpl(fileName));
auto internalResult = toImpl(this)->initializeScript(toImpl(script), toImpl(fileName), isModule);
ScriptParserRef::InitializeScriptResult result;
if (internalResult.script) {
result.script = toRef(internalResult.script.value());
Expand All @@ -2229,8 +2253,42 @@ ScriptParserRef::InitializeScriptResult ScriptParserRef::initializeScript(String
return result;
}

bool ScriptRef::isModule()
{
return toImpl(this)->isModule();
}

bool ScriptRef::isExecuted()
{
return toImpl(this)->isExecuted();
}

StringRef* ScriptRef::source()
{
return toRef(toImpl(this)->source());
}

StringRef* ScriptRef::src()
{
return toRef(toImpl(this)->src());
}

ValueRef* ScriptRef::execute(ExecutionStateRef* state)
{
return toRef(toImpl(this)->execute(*toImpl(state)));
}

PlatformRef::LoadModuleResult::LoadModuleResult(ScriptRef* result)
: script(result)
, errorMessage(StringRef::emptyString())
, errorCode(ErrorObjectRef::Code::None)
{
}

PlatformRef::LoadModuleResult::LoadModuleResult(ErrorObjectRef::Code errorCode, StringRef* errorMessage)
: script(nullptr)
, errorMessage(errorMessage)
, errorCode(errorCode)
{
}
}
71 changes: 48 additions & 23 deletions src/api/EscargotPublic.h
Expand Up @@ -77,6 +77,7 @@ class NumberObjectRef;
class BooleanObjectRef;
class RegExpObjectRef;
class ProxyObjectRef;
class PlatformRef;
class ScriptRef;
class ScriptParserRef;
class ExecutionStateRef;
Expand Down Expand Up @@ -141,13 +142,13 @@ class ESCARGOT_EXPORT PersistentRefHolder {
PersistentRefHolder(PersistentRefHolder<T>&& src)
{
m_holder = src.m_holder;
src.destoryHolderSpace();
src.m_holder = nullptr;
}

PersistentRefHolder<T>& operator=(PersistentRefHolder<T>&& src)
const PersistentRefHolder<T>& operator=(PersistentRefHolder<T>&& src)
{
m_holder = src.m_holder;
src.destoryHolderSpace();
src.m_holder = nullptr;

return *this;
}
Expand Down Expand Up @@ -196,7 +197,7 @@ class ESCARGOT_EXPORT PersistentRefHolder {
private:
void initHolderSpace(T* initialValue)
{
m_holder = (T**)Memory::gcMallocUncollectable(sizeof(T*));
m_holder = (T**)Memory::gcMallocUncollectable(sizeof(T**));
*m_holder = initialValue;
}

Expand Down Expand Up @@ -399,25 +400,8 @@ class ESCARGOT_EXPORT OptionalRef {
T* m_value;
};

class ESCARGOT_EXPORT PlatformRef {
public:
virtual ~PlatformRef() {}
// client must returns zero-filled memory
virtual void* arrayBufferObjectDataBufferMallocCallback(ContextRef* whereObjectMade, ArrayBufferObjectRef* obj, size_t sizeInByte)
{
return calloc(sizeInByte, 1);
}
virtual void arrayBufferObjectDataBufferFreeCallback(ContextRef* whereObjectMade, ArrayBufferObjectRef* obj, void* buffer)
{
return free(buffer);
}

// If you want to use promise on Escargot, you should call VMInstanceRef::executePendingPromiseJob after event. see Shell.cpp
virtual void didPromiseJobEnqueued(ContextRef* relatedContext, PromiseObjectRef* obj) = 0;
};

// Don't save ExecutionStateRef anywhere yourself
// If you want to acquire ExecutionStateRef, you can use Evaluator::run
// If you want to acquire ExecutionStateRef, you can use Evaluator::execute
class ESCARGOT_EXPORT ExecutionStateRef {
public:
OptionalRef<FunctionObjectRef> resolveCallee(); // resolve nearest callee if exists
Expand Down Expand Up @@ -1335,14 +1319,55 @@ class ESCARGOT_EXPORT ScriptParserRef {
ScriptRef* fetchScriptThrowsExceptionIfParseError(ExecutionStateRef* state);
};

InitializeScriptResult initializeScript(StringRef* scriptSource, StringRef* fileName);
InitializeScriptResult initializeScript(StringRef* scriptSource, StringRef* fileName, bool isModule = false);
};

class ESCARGOT_EXPORT ScriptRef {
public:
bool isModule();
bool isExecuted();
StringRef* source();
StringRef* src();
ValueRef* execute(ExecutionStateRef* state);
};

class ESCARGOT_EXPORT PlatformRef {
public:
virtual ~PlatformRef() {}
// ArrayBuffer
// client must returns zero-filled memory
virtual void* onArrayBufferObjectDataBufferMalloc(ContextRef* whereObjectMade, ArrayBufferObjectRef* obj, size_t sizeInByte)
{
return calloc(sizeInByte, 1);
}
virtual void onArrayBufferObjectDataBufferFree(ContextRef* whereObjectMade, ArrayBufferObjectRef* obj, void* buffer)
{
return free(buffer);
}

// Promise
// If you want to use promise on Escargot, you should call VMInstanceRef::executePendingPromiseJob after event. see Shell.cpp
virtual void didPromiseJobEnqueued(ContextRef* relatedContext, PromiseObjectRef* obj) = 0;

// Module
virtual void willLoadModuleWhenScriptExecuted(ContextRef* relatedContext, ScriptRef* whereRequestFrom, StringRef* moduleSrc)
{
// This callback is may optional
}
// escargot request module load per every import statement
// client needs cache module map<absolute_module_path, ScriptRef*>
struct LoadModuleResult {
LoadModuleResult(ScriptRef* result);
LoadModuleResult(ErrorObjectRef::Code errorCode, StringRef* errorMessage);

OptionalRef<ScriptRef> script;
StringRef* errorMessage;
ErrorObjectRef::Code errorCode;
};
virtual LoadModuleResult onLoadModule(ContextRef* relatedContext, ScriptRef* whereRequestFrom, StringRef* moduleSrc) = 0;
virtual void didLoadModule(ContextRef* relatedContext, OptionalRef<ScriptRef> whereRequestFrom, ScriptRef* loadedModule) = 0;
};

} // namespace Escargot

#endif
5 changes: 2 additions & 3 deletions src/interpreter/ByteCode.cpp
Expand Up @@ -98,10 +98,9 @@ void ByteCodeBlock::fillLocDataIfNeeded(Context* c)
}

ByteCodeBlock* block;
// TODO
// give correct stack limit to parser
// TODO give correct stack limit to parser
if (m_codeBlock->asInterpretedCodeBlock()->isGlobalScopeCodeBlock()) {
RefPtr<ProgramNode> nd = esprima::parseProgram(c, m_codeBlock->asInterpretedCodeBlock()->src(), m_codeBlock->asInterpretedCodeBlock()->isStrict(), m_codeBlock->inWith(), SIZE_MAX, false, false);
RefPtr<ProgramNode> nd = esprima::parseProgram(c, m_codeBlock->asInterpretedCodeBlock()->src(), m_codeBlock->script()->isModule(), m_codeBlock->asInterpretedCodeBlock()->isStrict(), m_codeBlock->inWith(), SIZE_MAX, false, false);
block = ByteCodeGenerator::generateByteCode(c, m_codeBlock->asInterpretedCodeBlock(), nd.get(), nd->scopeContext(), m_isEvalMode, m_isOnGlobal, false, true);
} else {
ASTFunctionScopeContext* scopeContext = nullptr;
Expand Down

0 comments on commit eceffac

Please sign in to comment.