Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 2f0c86d60545223b1c92c623d5b8cae294ac74cb..9cfb4f0f087aa27e9bb514ea8aa8b9dafff2ad7c 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -2697,10 +2697,11 @@ HInstruction* HGraphBuilder::BuildGetNativeContext(HValue* closure) { |
HInstruction* HGraphBuilder::BuildGetNativeContext() { |
// Get the global context, then the native context |
- HInstruction* global_object = Add<HGlobalObject>(); |
- HObjectAccess access = HObjectAccess::ForJSObjectOffset( |
- GlobalObject::kNativeContextOffset); |
- return Add<HLoadNamedField>(global_object, access); |
+ HValue* global_object = Add<HLoadNamedField>( |
+ context(), HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); |
+ return Add<HLoadNamedField>( |
+ global_object, HObjectAccess::ForJSObjectOffset( |
+ GlobalObject::kNativeContextOffset)); |
} |
@@ -2896,7 +2897,8 @@ HStoreNamedField* HGraphBuilder::AddStoreMapConstant(HValue *object, |
HValue* HGraphBuilder::AddLoadJSBuiltin(Builtins::JavaScript builtin) { |
- HGlobalObject* global_object = Add<HGlobalObject>(); |
+ HValue* global_object = Add<HLoadNamedField>( |
+ context(), HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); |
HObjectAccess access = HObjectAccess::ForJSObjectOffset( |
GlobalObject::kBuiltinsOffset); |
HValue* builtins = Add<HLoadNamedField>(global_object, access); |
@@ -4777,7 +4779,9 @@ void HOptimizedGraphBuilder::VisitVariableProxy(VariableProxy* expr) { |
return ast_context()->ReturnInstruction(instr, expr->id()); |
} |
} else { |
- HGlobalObject* global_object = Add<HGlobalObject>(); |
+ HValue* global_object = Add<HLoadNamedField>( |
+ context(), HObjectAccess::ForContextSlot( |
+ Context::GLOBAL_OBJECT_INDEX)); |
HLoadGlobalGeneric* instr = |
New<HLoadGlobalGeneric>(global_object, |
variable->name(), |
@@ -5901,7 +5905,8 @@ void HOptimizedGraphBuilder::HandleGlobalVariableAssignment( |
Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |
} |
} else { |
- HGlobalObject* global_object = Add<HGlobalObject>(); |
+ HValue* global_object = Add<HLoadNamedField>( |
+ context(), HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); |
HStoreNamedGeneric* instr = |
Add<HStoreNamedGeneric>(global_object, var->name(), |
value, function_strict_mode_flag()); |
@@ -7954,7 +7959,9 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) { |
if (known_global_function) { |
// Push the global object instead of the global receiver because |
// code generated by the full code generator expects it. |
- HGlobalObject* global_object = Add<HGlobalObject>(); |
+ HValue* global_object = Add<HLoadNamedField>( |
+ context(), HObjectAccess::ForContextSlot( |
+ Context::GLOBAL_OBJECT_INDEX)); |
Push(global_object); |
CHECK_ALIVE(VisitExpressions(expr->arguments())); |
@@ -7985,7 +7992,9 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) { |
if (CallStubCompiler::HasCustomCallGenerator(expr->target())) { |
// We're about to install a contextual IC, which expects the global |
// object as receiver rather than the global proxy. |
- HGlobalObject* global_object = Add<HGlobalObject>(); |
+ HValue* global_object = Add<HLoadNamedField>( |
+ context(), HObjectAccess::ForContextSlot( |
+ Context::GLOBAL_OBJECT_INDEX)); |
const int receiver_index = argument_count - 1; |
environment()->SetExpressionStackAt(receiver_index, global_object); |
// When the target has a custom call IC generator, use the IC, |
@@ -7997,7 +8006,9 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) { |
PushArgumentsFromEnvironment(argument_count); |
} |
} else { |
- HGlobalObject* receiver = Add<HGlobalObject>(); |
+ HValue* receiver = Add<HLoadNamedField>( |
+ context(), HObjectAccess::ForContextSlot( |
+ Context::GLOBAL_OBJECT_INDEX)); |
Push(Add<HPushArgument>(receiver)); |
CHECK_ALIVE(VisitArgumentList(expr->arguments())); |