Commit 29e15dad authored by titzer's avatar titzer Committed by Commit bot

[turbofan] Add FrameStates before all property accesses.

R=jarin@chromium.org
BUG=

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

Cr-Commit-Position: refs/heads/master@{#28392}
parent e73594c7
This diff is collapsed.
...@@ -255,14 +255,15 @@ class AstGraphBuilder : public AstVisitor { ...@@ -255,14 +255,15 @@ class AstGraphBuilder : public AstVisitor {
Node* BuildRestArgumentsArray(Variable* rest, int index); Node* BuildRestArgumentsArray(Variable* rest, int index);
// Builders for variable load and assignment. // Builders for variable load and assignment.
Node* BuildVariableAssignment(Variable* var, Node* value, Token::Value op, Node* BuildVariableAssignment(
BailoutId bailout_id, FrameStateBeforeAndAfter& states, Variable* var, Node* value,
OutputFrameStateCombine state_combine = Token::Value op, BailoutId bailout_id,
OutputFrameStateCombine::Ignore()); OutputFrameStateCombine combine = OutputFrameStateCombine::Ignore());
Node* BuildVariableDelete(Variable* var, BailoutId bailout_id, Node* BuildVariableDelete(Variable* var, BailoutId bailout_id,
OutputFrameStateCombine state_combine); OutputFrameStateCombine combine);
Node* BuildVariableLoad(Variable* var, BailoutId bailout_id, Node* BuildVariableLoad(FrameStateBeforeAndAfter& states, Variable* var,
const VectorSlotPair& feedback, BailoutId bailout_id, const VectorSlotPair& feedback,
OutputFrameStateCombine combine,
ContextualMode mode = CONTEXTUAL); ContextualMode mode = CONTEXTUAL);
// Builders for property loads and stores. // Builders for property loads and stores.
......
This diff is collapsed.
...@@ -61,9 +61,6 @@ Reduction JSTypeFeedbackSpecializer::Reduce(Node* node) { ...@@ -61,9 +61,6 @@ Reduction JSTypeFeedbackSpecializer::Reduce(Node* node) {
// StoreProperty(o, "constant", v) => StoreNamed["constant"](o, v). // StoreProperty(o, "constant", v) => StoreNamed["constant"](o, v).
Unique<Name> name = match.Value(); Unique<Name> name = match.Value();
LanguageMode language_mode = OpParameter<LanguageMode>(node); LanguageMode language_mode = OpParameter<LanguageMode>(node);
// StoreProperty has 2 frame state inputs, but StoreNamed only 1.
DCHECK_EQ(2, OperatorProperties::GetFrameStateInputCount(node->op()));
node->RemoveInput(NodeProperties::FirstFrameStateIndex(node) + 1);
node->set_op( node->set_op(
jsgraph()->javascript()->StoreNamed(language_mode, name, KEYED)); jsgraph()->javascript()->StoreNamed(language_mode, name, KEYED));
node->RemoveInput(1); node->RemoveInput(1);
......
...@@ -59,17 +59,14 @@ int OperatorProperties::GetFrameStateInputCount(const Operator* op) { ...@@ -59,17 +59,14 @@ int OperatorProperties::GetFrameStateInputCount(const Operator* op) {
// Misc operations // Misc operations
case IrOpcode::kJSStackCheck: case IrOpcode::kJSStackCheck:
case IrOpcode::kJSDeleteProperty:
return 1;
// Properties // We record the frame state immediately before and immediately after
// every property access.
case IrOpcode::kJSLoadNamed: case IrOpcode::kJSLoadNamed:
case IrOpcode::kJSStoreNamed: case IrOpcode::kJSStoreNamed:
case IrOpcode::kJSLoadProperty: case IrOpcode::kJSLoadProperty:
case IrOpcode::kJSDeleteProperty:
return 1;
// StoreProperty provides a second frame state just before
// the operation. This is used to lazy-deoptimize a to-number
// conversion for typed arrays.
case IrOpcode::kJSStoreProperty: case IrOpcode::kJSStoreProperty:
return 2; return 2;
......
...@@ -80,10 +80,13 @@ class JSTypeFeedbackTest : public TypedGraphTest { ...@@ -80,10 +80,13 @@ class JSTypeFeedbackTest : public TypedGraphTest {
Unique<Name> name = Unique<Name>::CreateUninitialized( Unique<Name> name = Unique<Name>::CreateUninitialized(
isolate()->factory()->NewStringFromAsciiChecked(string)); isolate()->factory()->NewStringFromAsciiChecked(string));
Node* load = graph()->NewNode(javascript()->LoadNamed(name, feedback), const Operator* op = javascript()->LoadNamed(name, feedback);
global, context); Node* load = graph()->NewNode(op, global, context);
if (FLAG_turbo_deoptimization) { if (FLAG_turbo_deoptimization) {
load->AppendInput(zone(), EmptyFrameState()); for (int i = 0; i < OperatorProperties::GetFrameStateInputCount(op);
i++) {
load->AppendInput(zone(), EmptyFrameState());
}
} }
load->AppendInput(zone(), effect); load->AppendInput(zone(), effect);
load->AppendInput(zone(), control); load->AppendInput(zone(), control);
......
...@@ -659,9 +659,9 @@ TEST_F(JSTypedLoweringTest, JSLoadPropertyFromExternalTypedArray) { ...@@ -659,9 +659,9 @@ TEST_F(JSTypedLoweringTest, JSLoadPropertyFromExternalTypedArray) {
Node* context = UndefinedConstant(); Node* context = UndefinedConstant();
Node* effect = graph()->start(); Node* effect = graph()->start();
Node* control = graph()->start(); Node* control = graph()->start();
Reduction r = Reduction r = Reduce(graph()->NewNode(javascript()->LoadProperty(feedback),
Reduce(graph()->NewNode(javascript()->LoadProperty(feedback), base, key, base, key, context, EmptyFrameState(),
context, EmptyFrameState(), effect, control)); EmptyFrameState(), effect, control));
Matcher<Node*> offset_matcher = Matcher<Node*> offset_matcher =
element_size == 1 element_size == 1
...@@ -700,9 +700,9 @@ TEST_F(JSTypedLoweringTest, JSLoadPropertyFromExternalTypedArrayWithSafeKey) { ...@@ -700,9 +700,9 @@ TEST_F(JSTypedLoweringTest, JSLoadPropertyFromExternalTypedArrayWithSafeKey) {
Node* context = UndefinedConstant(); Node* context = UndefinedConstant();
Node* effect = graph()->start(); Node* effect = graph()->start();
Node* control = graph()->start(); Node* control = graph()->start();
Reduction r = Reduction r = Reduce(graph()->NewNode(javascript()->LoadProperty(feedback),
Reduce(graph()->NewNode(javascript()->LoadProperty(feedback), base, key, base, key, context, EmptyFrameState(),
context, EmptyFrameState(), effect, control)); EmptyFrameState(), effect, control));
ASSERT_TRUE(r.Changed()); ASSERT_TRUE(r.Changed());
EXPECT_THAT( EXPECT_THAT(
......
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