Commit bf7034bf authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[turbofan] Remove eager frame state from property access.

This removes the frame state input representing the before-state from
nodes performing property accesses. These frame states can by now be
found via checkpoints in the graph.

R=jarin@chromium.org
BUG=v8:5021

Review-Url: https://codereview.chromium.org/2034673002
Cr-Commit-Position: refs/heads/master@{#36699}
parent 16dda215
......@@ -418,11 +418,13 @@ class AstGraphBuilder::FrameStateBeforeAndAfter {
frame_state_before_ = id_before == BailoutId::None()
? builder_->GetEmptyFrameState()
: builder_->environment()->Checkpoint(id_before);
// Create an explicit checkpoint node for before the operation.
Node* node = builder_->NewNode(builder_->common()->Checkpoint());
DCHECK_EQ(IrOpcode::kDead,
NodeProperties::GetFrameStateInput(node, 0)->opcode());
NodeProperties::ReplaceFrameStateInput(node, 0, frame_state_before_);
if (id_before != BailoutId::None()) {
// Create an explicit checkpoint node for before the operation.
Node* node = builder_->NewNode(builder_->common()->Checkpoint());
DCHECK_EQ(IrOpcode::kDead,
NodeProperties::GetFrameStateInput(node, 0)->opcode());
NodeProperties::ReplaceFrameStateInput(node, 0, frame_state_before_);
}
}
void AddToNode(
......
......@@ -131,9 +131,9 @@ Reduction JSGlobalObjectSpecialization::ReduceJSStoreGlobal(Node* node) {
DCHECK_EQ(IrOpcode::kJSStoreGlobal, node->opcode());
Handle<Name> name = StoreGlobalParametersOf(node->op()).name();
Node* value = NodeProperties::GetValueInput(node, 0);
Node* frame_state = NodeProperties::GetFrameStateInput(node, 1);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
Node* frame_state = NodeProperties::FindFrameStateBefore(node);
// Retrieve the global object from the given {node}.
Handle<JSGlobalObject> global_object;
......
......@@ -79,9 +79,9 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
node->opcode() == IrOpcode::kJSLoadProperty ||
node->opcode() == IrOpcode::kJSStoreProperty);
Node* receiver = NodeProperties::GetValueInput(node, 0);
Node* frame_state = NodeProperties::GetFrameStateInput(node, 1);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
Node* frame_state = NodeProperties::FindFrameStateBefore(node);
// Not much we can do if deoptimization support is disabled.
if (!(flags() & kDeoptimizationEnabled)) return NoChange();
......@@ -524,9 +524,9 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
node->opcode() == IrOpcode::kJSStoreProperty);
Node* receiver = NodeProperties::GetValueInput(node, 0);
Node* context = NodeProperties::GetContextInput(node);
Node* frame_state = NodeProperties::GetFrameStateInput(node, 1);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
Node* frame_state = NodeProperties::FindFrameStateBefore(node);
// Not much we can do if deoptimization support is disabled.
if (!(flags() & kDeoptimizationEnabled)) return NoChange();
......@@ -970,9 +970,9 @@ Reduction JSNativeContextSpecialization::ReduceKeyedAccess(
Reduction JSNativeContextSpecialization::ReduceSoftDeoptimize(Node* node) {
Node* frame_state = NodeProperties::GetFrameStateInput(node, 1);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
Node* frame_state = NodeProperties::FindFrameStateBefore(node);
Node* deoptimize =
graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kSoft), frame_state,
effect, control);
......
......@@ -1106,7 +1106,7 @@ Reduction JSTypedLowering::ReduceJSStoreProperty(Node* node) {
value = number_reduction.replacement();
} else {
Node* frame_state_for_to_number =
NodeProperties::GetFrameStateInput(node, 1);
NodeProperties::FindFrameStateBefore(node);
value = effect =
graph()->NewNode(javascript()->ToNumber(), value, context,
frame_state_for_to_number, effect, control);
......
......@@ -49,6 +49,15 @@ int OperatorProperties::GetFrameStateInputCount(const Operator* op) {
case IrOpcode::kJSCreateLiteralObject:
case IrOpcode::kJSCreateLiteralRegExp:
// Property access operations
case IrOpcode::kJSLoadNamed:
case IrOpcode::kJSStoreNamed:
case IrOpcode::kJSLoadProperty:
case IrOpcode::kJSStoreProperty:
case IrOpcode::kJSLoadGlobal:
case IrOpcode::kJSStoreGlobal:
case IrOpcode::kJSDeleteProperty:
// Context operations
case IrOpcode::kJSCreateScriptContext:
......@@ -69,17 +78,11 @@ int OperatorProperties::GetFrameStateInputCount(const Operator* op) {
case IrOpcode::kJSForInNext:
case IrOpcode::kJSForInPrepare:
case IrOpcode::kJSStackCheck:
case IrOpcode::kJSDeleteProperty:
return 1;
// We record the frame state immediately before and immediately after
// every property or global variable access.
case IrOpcode::kJSLoadNamed:
case IrOpcode::kJSStoreNamed:
case IrOpcode::kJSLoadProperty:
case IrOpcode::kJSStoreProperty:
case IrOpcode::kJSLoadGlobal:
case IrOpcode::kJSStoreGlobal:
return 2;
// Binary operators that can deopt in the middle the operation (e.g.,
......
......@@ -603,9 +603,9 @@ TEST_F(JSTypedLoweringTest, JSLoadPropertyFromExternalTypedArray) {
Node* context = UndefinedConstant();
Node* effect = graph()->start();
Node* control = graph()->start();
Reduction r = Reduce(graph()->NewNode(
javascript()->LoadProperty(feedback), base, key, vector, context,
EmptyFrameState(), EmptyFrameState(), effect, control));
Reduction r = Reduce(graph()->NewNode(javascript()->LoadProperty(feedback),
base, key, vector, context,
EmptyFrameState(), effect, control));
Matcher<Node*> offset_matcher =
element_size == 1
......@@ -644,9 +644,9 @@ TEST_F(JSTypedLoweringTest, JSLoadPropertyFromExternalTypedArrayWithSafeKey) {
Node* context = UndefinedConstant();
Node* effect = graph()->start();
Node* control = graph()->start();
Reduction r = Reduce(graph()->NewNode(
javascript()->LoadProperty(feedback), base, key, vector, context,
EmptyFrameState(), EmptyFrameState(), effect, control));
Reduction r = Reduce(graph()->NewNode(javascript()->LoadProperty(feedback),
base, key, vector, context,
EmptyFrameState(), effect, control));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(
......@@ -685,8 +685,7 @@ TEST_F(JSTypedLoweringTest, JSStorePropertyToExternalTypedArray) {
VectorSlotPair feedback;
const Operator* op = javascript()->StoreProperty(language_mode, feedback);
Node* node = graph()->NewNode(op, base, key, value, vector, context,
EmptyFrameState(), EmptyFrameState(),
effect, control);
EmptyFrameState(), effect, control);
Reduction r = Reduce(node);
Matcher<Node*> offset_matcher =
......@@ -726,11 +725,14 @@ TEST_F(JSTypedLoweringTest, JSStorePropertyToExternalTypedArrayWithConversion) {
Node* context = UndefinedConstant();
Node* effect = graph()->start();
Node* control = graph()->start();
// TODO(mstarzinger): Once the effect-control-linearizer provides a frame
// state we can get rid of this checkpoint again. The reducer won't care.
Node* checkpoint = graph()->NewNode(common()->Checkpoint(),
EmptyFrameState(), effect, control);
VectorSlotPair feedback;
const Operator* op = javascript()->StoreProperty(language_mode, feedback);
Node* node = graph()->NewNode(op, base, key, value, vector, context,
EmptyFrameState(), EmptyFrameState(),
effect, control);
EmptyFrameState(), checkpoint, control);
Reduction r = Reduce(node);
Matcher<Node*> offset_matcher =
......@@ -739,7 +741,7 @@ TEST_F(JSTypedLoweringTest, JSStorePropertyToExternalTypedArrayWithConversion) {
: IsWord32Shl(key, IsInt32Constant(WhichPowerOf2(element_size)));
Matcher<Node*> value_matcher =
IsToNumber(value, context, effect, control);
IsToNumber(value, context, checkpoint, control);
Matcher<Node*> effect_matcher = value_matcher;
ASSERT_TRUE(r.Changed());
......@@ -779,8 +781,7 @@ TEST_F(JSTypedLoweringTest, JSStorePropertyToExternalTypedArrayWithSafeKey) {
VectorSlotPair feedback;
const Operator* op = javascript()->StoreProperty(language_mode, feedback);
Node* node = graph()->NewNode(op, base, key, value, vector, context,
EmptyFrameState(), EmptyFrameState(),
effect, control);
EmptyFrameState(), effect, control);
Reduction r = Reduce(node);
ASSERT_TRUE(r.Changed());
......@@ -806,9 +807,9 @@ TEST_F(JSTypedLoweringTest, JSLoadNamedStringLength) {
Node* const context = UndefinedConstant();
Node* const effect = graph()->start();
Node* const control = graph()->start();
Reduction const r = Reduce(graph()->NewNode(
javascript()->LoadNamed(name, feedback), receiver, vector, context,
EmptyFrameState(), EmptyFrameState(), effect, control));
Reduction const r = Reduce(
graph()->NewNode(javascript()->LoadNamed(name, feedback), receiver,
vector, context, EmptyFrameState(), effect, control));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsLoadField(AccessBuilder::ForStringLength(),
receiver, effect, 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