Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 3386e60cb08cfcedf1a0cc2f4f1cd07bfa0963a8..4b52f26a84e7aa75bd9886d9e6beef2efc7b579e 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -5376,6 +5376,22 @@ void HOptimizedGraphBuilder::VisitVariableProxy(VariableProxy* expr) { |
} |
Handle<GlobalObject> global(current_info()->global_object()); |
+ |
+ if (FLAG_harmony_scoping) { |
+ Handle<GlobalContextTable> global_contexts( |
+ global->native_context()->global_context_table()); |
+ GlobalContextTable::LookupResult lookup; |
+ if (GlobalContextTable::Lookup(global_contexts, variable->name(), |
+ &lookup)) { |
+ Handle<Context> global_context = GlobalContextTable::GetContext( |
+ global_contexts, lookup.context_index); |
+ HInstruction* result = New<HLoadNamedField>( |
+ Add<HConstant>(global_context), static_cast<HValue*>(NULL), |
+ HObjectAccess::ForContextSlot(lookup.slot_index)); |
+ return ast_context()->ReturnInstruction(result, expr->id()); |
+ } |
+ } |
+ |
LookupIterator it(global, variable->name(), |
LookupIterator::OWN_SKIP_INTERCEPTOR); |
GlobalPropertyAccess type = LookupGlobalProperty(variable, &it, LOAD); |