mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
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>
This commit is contained in:
parent
52d51d976e
commit
98bc107937
15 changed files with 328 additions and 186 deletions
|
|
@ -24,8 +24,10 @@
|
|||
#include "interpreter/ByteCodeInterpreter.h"
|
||||
#include "parser/ast/Node.h"
|
||||
#include "runtime/Context.h"
|
||||
#include "runtime/Global.h"
|
||||
#include "runtime/Environment.h"
|
||||
#include "runtime/EnvironmentRecord.h"
|
||||
#include "runtime/Platform.h"
|
||||
#include "runtime/ErrorObject.h"
|
||||
#include "runtime/ExtendedNativeFunctionObject.h"
|
||||
#include "runtime/SandBox.h"
|
||||
|
|
@ -80,12 +82,12 @@ Context* Script::context()
|
|||
|
||||
Script* Script::loadModuleFromScript(ExecutionState& state, String* src)
|
||||
{
|
||||
Platform::LoadModuleResult result = context()->vmInstance()->platform()->onLoadModule(context(), this, src);
|
||||
Platform::LoadModuleResult result = Global::platform()->onLoadModule(context(), this, src);
|
||||
if (!result.script) {
|
||||
ErrorObject::throwBuiltinError(state, (ErrorObject::Code)result.errorCode, result.errorMessage->toNonGCUTF8StringData().data());
|
||||
}
|
||||
if (!result.script->moduleData()->m_didCallLoadedCallback) {
|
||||
context()->vmInstance()->platform()->didLoadModule(context(), this, result.script.value());
|
||||
Global::platform()->didLoadModule(context(), this, result.script.value());
|
||||
result.script->moduleData()->m_didCallLoadedCallback = true;
|
||||
}
|
||||
return result.script.value();
|
||||
|
|
@ -323,7 +325,7 @@ Value Script::execute(ExecutionState& state, bool isExecuteOnEvalFunction, bool
|
|||
|
||||
if (isModule()) {
|
||||
if (!moduleData()->m_didCallLoadedCallback) {
|
||||
context()->vmInstance()->platform()->didLoadModule(context(), nullptr, this);
|
||||
Global::platform()->didLoadModule(context(), nullptr, this);
|
||||
moduleData()->m_didCallLoadedCallback = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue