Index: src/runtime/runtime-scopes.cc |
diff --git a/src/runtime/runtime-scopes.cc b/src/runtime/runtime-scopes.cc |
index 7bc24afbcb489ca4ccdae4cddd20d458ef786796..fb0b2e31e9acf5c3c058f5ade0de4f7bc96c4e73 100644 |
--- a/src/runtime/runtime-scopes.cc |
+++ b/src/runtime/runtime-scopes.cc |
@@ -636,7 +636,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; |
@@ -644,12 +643,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->InvalidateGlobalSlots(); |
Toon Verwaest
2015/07/01 09:28:55
InitializeGlobalSlots
Igor Sheludko
2015/07/02 16:50:13
Done.
|
+ |
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); |