| Index: src/runtime/runtime-scopes.cc
|
| diff --git a/src/runtime/runtime-scopes.cc b/src/runtime/runtime-scopes.cc
|
| index 8b34b6ced704b19774be896fa82092af9cf701dd..700925db622d718cd1497707de9058aa6c691337 100644
|
| --- a/src/runtime/runtime-scopes.cc
|
| +++ b/src/runtime/runtime-scopes.cc
|
| @@ -632,7 +632,6 @@ RUNTIME_FUNCTION(Runtime_NewScriptContext) {
|
| Handle<ScriptContextTable> script_context_table(
|
| native_context->script_context_table());
|
|
|
| - Handle<String> clashed_name;
|
| Object* name_clash_result =
|
| FindNameClash(scope_info, global_object, script_context_table);
|
| if (isolate->has_pending_exception()) return name_clash_result;
|
| @@ -640,12 +639,16 @@ RUNTIME_FUNCTION(Runtime_NewScriptContext) {
|
| // Script contexts have a canonical empty function as their closure, not the
|
| // anonymous closure containing the global code. See
|
| // FullCodeGenerator::PushFunctionArgumentForContextAllocation.
|
| - Handle<JSFunction> closure(native_context->closure());
|
| + Handle<JSFunction> closure(global_object->IsJSBuiltinsObject()
|
| + ? *function
|
| + : native_context->closure());
|
| Handle<Context> result =
|
| isolate->factory()->NewScriptContext(closure, scope_info);
|
|
|
| + result->InitializeGlobalSlots();
|
| +
|
| DCHECK(function->context() == isolate->context());
|
| - DCHECK(function->context()->global_object() == result->global_object());
|
| + DCHECK(*global_object == result->global_object());
|
|
|
| Handle<ScriptContextTable> new_script_context_table =
|
| ScriptContextTable::Extend(script_context_table, result);
|
|
|