Index: src/compiler/js-generic-lowering.cc |
diff --git a/src/compiler/js-generic-lowering.cc b/src/compiler/js-generic-lowering.cc |
index 3526715638ad6ff90af8f164c6d1d89498e037c3..f87006f08b4c4a5d8267099cd10ad9efa0e36580 100644 |
--- a/src/compiler/js-generic-lowering.cc |
+++ b/src/compiler/js-generic-lowering.cc |
@@ -388,9 +388,19 @@ Node* JSGenericLowering::LowerJSLoadContext(Node* node) { |
Node* JSGenericLowering::LowerJSStoreContext(Node* node) { |
ContextAccess access = OpParameter<ContextAccess>(node); |
- PatchInsertInput(node, 1, SmiConstant(access.depth())); |
- PatchInsertInput(node, 2, SmiConstant(access.index())); |
- ReplaceWithRuntimeCall(node, Runtime::kStoreContextRelative, 4); |
+ // TODO(mstarzinger): Use simplified operators instead of machine operators |
+ // here so that load/store optimization can be applied afterwards. |
+ for (int i = 0; i < access.depth(); ++i) { |
+ node->ReplaceInput( |
+ 0, graph()->NewNode( |
+ machine()->Load(kMachineTagged), |
+ NodeProperties::GetValueInput(node, 0), |
+ Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)), |
+ NodeProperties::GetEffectInput(node))); |
+ } |
+ node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1)); |
+ node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index()))); |
+ PatchOperator(node, machine()->Store(kMachineTagged, kFullWriteBarrier)); |
return node; |
} |