Commit e3ecfdfe authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Properly wire effects for JSLoadContext and JSStoreContext.

The effect chain should be respected for context loads and stores.

R=mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/1479793003

Cr-Commit-Position: refs/heads/master@{#32363}
parent 5874ac78
......@@ -1219,14 +1219,14 @@ Reduction JSTypedLowering::ReduceJSInstanceOf(Node* node) {
Reduction JSTypedLowering::ReduceJSLoadContext(Node* node) {
DCHECK_EQ(IrOpcode::kJSLoadContext, node->opcode());
ContextAccess const& access = ContextAccessOf(node->op());
Node* const effect = NodeProperties::GetEffectInput(node);
Node* const control = graph()->start();
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = graph()->start();
for (size_t i = 0; i < access.depth(); ++i) {
node->ReplaceInput(
0, graph()->NewNode(
simplified()->LoadField(
AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX)),
NodeProperties::GetValueInput(node, 0), effect, control));
Node* previous = effect = graph()->NewNode(
simplified()->LoadField(
AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX)),
NodeProperties::GetValueInput(node, 0), effect, control);
node->ReplaceInput(0, previous);
}
node->ReplaceInput(1, effect);
node->ReplaceInput(2, control);
......@@ -1240,16 +1240,17 @@ Reduction JSTypedLowering::ReduceJSLoadContext(Node* node) {
Reduction JSTypedLowering::ReduceJSStoreContext(Node* node) {
DCHECK_EQ(IrOpcode::kJSStoreContext, node->opcode());
ContextAccess const& access = ContextAccessOf(node->op());
Node* const effect = NodeProperties::GetEffectInput(node);
Node* const control = graph()->start();
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = graph()->start();
for (size_t i = 0; i < access.depth(); ++i) {
node->ReplaceInput(
0, graph()->NewNode(
simplified()->LoadField(
AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX)),
NodeProperties::GetValueInput(node, 0), effect, control));
Node* previous = effect = graph()->NewNode(
simplified()->LoadField(
AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX)),
NodeProperties::GetValueInput(node, 0), effect, control);
node->ReplaceInput(0, previous);
}
node->RemoveInput(2);
node->ReplaceInput(2, effect);
NodeProperties::ChangeOp(
node,
simplified()->StoreField(AccessBuilder::ForContextSlot(access.index())));
......
......@@ -661,7 +661,7 @@ TEST_F(JSTypedLoweringTest, JSLoadContext) {
IsLoadField(AccessBuilder::ForContextSlot(
Context::PREVIOUS_INDEX),
context, effect, graph()->start()),
effect, graph()->start()));
_, graph()->start()));
}
}
}
......@@ -696,7 +696,7 @@ TEST_F(JSTypedLoweringTest, JSStoreContext) {
IsLoadField(AccessBuilder::ForContextSlot(
Context::PREVIOUS_INDEX),
context, effect, graph()->start()),
value, effect, control));
value, _, control));
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment