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

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: Created 5 years, 6 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
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);

Powered by Google App Engine
This is Rietveld 408576698