Index: src/d8.cc |
diff --git a/src/d8.cc b/src/d8.cc |
index 564aafe0050263b5128c1693ac9a0845bd2fab1e..539ebaae755534ea1bbb8050c627c1368b2f844b 100644 |
--- a/src/d8.cc |
+++ b/src/d8.cc |
@@ -205,7 +205,9 @@ bool Shell::ExecuteString(Isolate* isolate, |
// When debugging make exceptions appear to be uncaught. |
try_catch.SetVerbose(true); |
} |
- Handle<Script> script = Script::New(source, name); |
+ ScriptOrigin origin(name); |
+ Handle<UnboundScript> script = ScriptCompiler::CompileUnbound( |
+ isolate, ScriptCompiler::Source(source, origin)); |
if (script.IsEmpty()) { |
// Print errors that happened during compilation. |
if (report_exceptions && !FLAG_debugger) |
@@ -216,7 +218,7 @@ bool Shell::ExecuteString(Isolate* isolate, |
Local<Context> realm = |
Local<Context>::New(isolate, data->realms_[data->realm_current_]); |
realm->Enter(); |
- Handle<Value> result = script->Run(); |
+ Handle<Value> result = script->BindToCurrentContext()->Run(); |
realm->Exit(); |
data->realm_current_ = data->realm_switch_; |
if (result.IsEmpty()) { |
@@ -405,11 +407,12 @@ void Shell::RealmEval(const v8::FunctionCallbackInfo<v8::Value>& args) { |
Throw(args.GetIsolate(), "Invalid argument"); |
return; |
} |
- Handle<Script> script = Script::New(args[1]->ToString()); |
+ Handle<UnboundScript> script = ScriptCompiler::CompileUnbound( |
+ isolate, ScriptCompiler::Source(args[1]->ToString())); |
if (script.IsEmpty()) return; |
Local<Context> realm = Local<Context>::New(isolate, data->realms_[index]); |
realm->Enter(); |
- Handle<Value> result = script->Run(); |
+ Handle<Value> result = script->BindToCurrentContext()->Run(); |
realm->Exit(); |
args.GetReturnValue().Set(result); |
} |
@@ -806,7 +809,8 @@ void Shell::InstallUtilityScript(Isolate* isolate) { |
Handle<String> name = |
String::NewFromUtf8(isolate, shell_source_name.start(), |
String::kNormalString, shell_source_name.length()); |
- Handle<Script> script = Script::Compile(source, name); |
+ ScriptOrigin origin(name); |
+ Handle<Script> script = Script::Compile(source, &origin); |
script->Run(); |
// Mark the d8 shell script as native to avoid it showing up as normal source |
// in the debugger. |