Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1114)

Unified Diff: src/runtime/runtime-scopes.cc

Issue 1218783005: Support for global var shortcuts in script contexts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixing builds Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | src/scopeinfo.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | src/scopeinfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698