Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index cb30a5319d0538e487b59e5527a013ea8e9a63b4..f2b28b93d7935680b01e362407a7ad586662b8c9 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -1873,7 +1873,7 @@ Local<Script> ScriptCompiler::Compile(Isolate* v8_isolate, |
origin.ResourceIsEmbedderDebugScript()->IsTrue()); |
} |
source->info->set_script(script); |
- source->info->SetContext(isolate->native_context()); |
+ source->info->set_context(isolate->native_context()); |
EXCEPTION_PREAMBLE(isolate); |
@@ -1887,18 +1887,17 @@ Local<Script> ScriptCompiler::Compile(Isolate* v8_isolate, |
i::Handle<i::SharedFunctionInfo>::null(); |
if (source->info->function() != NULL) { |
// Parsing has succeeded. |
- result = |
- i::Compiler::CompileStreamedScript(source->info.get(), str->length()); |
+ result = i::Compiler::CompileStreamedScript(script, source->info.get(), |
+ str->length()); |
} |
has_pending_exception = result.is_null(); |
if (has_pending_exception) isolate->ReportPendingMessages(); |
EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>()); |
- raw_result = *result; |
- // The Handle<Script> will go out of scope soon; make sure CompilationInfo |
- // doesn't point to it. |
- source->info->set_script(i::Handle<i::Script>()); |
- } // HandleScope goes out of scope. |
+ source->info->clear_script(); // because script goes out of scope. |
+ raw_result = *result; // TODO(titzer): use CloseAndEscape? |
+ } |
+ |
i::Handle<i::SharedFunctionInfo> result(raw_result, isolate); |
Local<UnboundScript> generic = ToApiHandle<UnboundScript>(result); |
if (generic.IsEmpty()) { |