History

Fixed evaluateInClosure and other V8 stuff

ksuprynowicz committed 3 years ago

Commit 70d4a431 parent cc20ced8 files · +378 −191Browse files

Showing the changes to libraries/script-engine/src/v8/ScriptProgramV8Wrapper.cpp (1 of 8 files). Show all

Unified · Split

libraries/script-engine/src/v8/ScriptProgramV8Wrapper.cpp+8−0
@@ -32,7 +32,14 @@ ScriptSyntaxCheckResultPointer ScriptProgramV8Wrapper::checkSyntax() { · 31 unmodified lines
32}32}
33 33
34bool ScriptProgramV8Wrapper::compile() {34bool ScriptProgramV8Wrapper::compile() {
35 if (_isCompiled) {
36 // V8TODO is there a case where source code changes later and needs to be compiled again?
37 // V8TODO is same program used from multiple isolates
38 return true;
39 }
35 auto isolate = _engine->getIsolate();40 auto isolate = _engine->getIsolate();
41 v8::Locker locker(isolate);
42 v8::Isolate::Scope isolateScope(isolate);
36 v8::HandleScope handleScope(isolate);43 v8::HandleScope handleScope(isolate);
37 auto context = _engine->getContext();44 auto context = _engine->getContext();
38 v8::Context::Scope contextScope(context);45 v8::Context::Scope contextScope(context);
@@ -48,6 +55,7 @@ bool ScriptProgramV8Wrapper::compile() { · 9 unmodified lines
48 qDebug() << "Script compilation succesful: " << _url;55 qDebug() << "Script compilation succesful: " << _url;
49 _compileResult = ScriptSyntaxCheckResultV8Wrapper(ScriptSyntaxCheckResult::Valid);56 _compileResult = ScriptSyntaxCheckResultV8Wrapper(ScriptSyntaxCheckResult::Valid);
50 _value = V8ScriptProgram(isolate, script);57 _value = V8ScriptProgram(isolate, script);
58 _isCompiled = true;
51 return true;59 return true;
52 }60 }
53 qDebug() << "Script compilation failed: " << _url;61 qDebug() << "Script compilation failed: " << _url;