Commit 4940c0bd authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Unify frame state inputs.

Now all nodes that care about deoptimization always take frame state
inputs no matter whether deoptimization is enabled for a particular
function. In case that deoptimization is off, the AstGraphBuilder just
inserts the empty frame state. This greatly simplifies the logic in
various places and makes testing easier as well, and is probably the
first step towards enabling --turbo-deoptimization by default.

There seems to be no noticable performance impact on asm.js programs.

Also fix the graph replay in order to regenerate the scheduler unittests.

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

Cr-Commit-Position: refs/heads/master@{#28026}
parent 26474269
......@@ -115,6 +115,7 @@ CompilationInfo::CompilationInfo(ParseInfo* parse_info)
if (isolate_->debug()->is_active()) MarkAsDebug();
if (FLAG_context_specialization) MarkAsContextSpecializing();
if (FLAG_turbo_builtin_inlining) MarkAsBuiltinInliningEnabled();
if (FLAG_turbo_deoptimization) MarkAsDeoptimizationEnabled();
if (FLAG_turbo_inlining) MarkAsInliningEnabled();
if (FLAG_turbo_splitting) MarkAsSplittingEnabled();
if (FLAG_turbo_types) MarkAsTypingEnabled();
......
......@@ -126,7 +126,8 @@ class CompilationInfo {
kDisableFutureOptimization = 1 << 12,
kSplittingEnabled = 1 << 13,
kBuiltinInliningEnabled = 1 << 14,
kTypeFeedbackEnabled = 1 << 15
kTypeFeedbackEnabled = 1 << 15,
kDeoptimizationEnabled = 1 << 16
};
explicit CompilationInfo(ParseInfo* parse_info);
......@@ -217,6 +218,12 @@ class CompilationInfo {
return GetFlag(kTypeFeedbackEnabled);
}
void MarkAsDeoptimizationEnabled() { SetFlag(kDeoptimizationEnabled); }
bool is_deoptimization_enabled() const {
return GetFlag(kDeoptimizationEnabled);
}
void MarkAsInliningEnabled() { SetFlag(kInliningEnabled); }
bool is_inlining_enabled() const { return GetFlag(kInliningEnabled); }
......
......@@ -738,7 +738,9 @@ void AstGraphBuilder::Environment::UpdateStateValuesWithCache(
Node* AstGraphBuilder::Environment::Checkpoint(
BailoutId ast_id, OutputFrameStateCombine combine) {
if (!FLAG_turbo_deoptimization) return nullptr;
if (!builder()->info()->is_deoptimization_enabled()) {
return builder()->jsgraph()->EmptyFrameState();
}
UpdateStateValues(&parameters_node_, 0, parameters_count());
UpdateStateValuesWithCache(&locals_node_, parameters_count(), locals_count());
......
......@@ -241,6 +241,7 @@ Reduction ChangeLowering::ChangeTaggedToFloat64(Node* value, Node* control) {
// else LoadHeapNumberValue(y)
Node* const object = NodeProperties::GetValueInput(value, 0);
Node* const context = NodeProperties::GetContextInput(value);
Node* const frame_state = NodeProperties::GetFrameStateInput(value, 0);
Node* const effect = NodeProperties::GetEffectInput(value);
Node* const control = NodeProperties::GetControlInput(value);
......@@ -253,12 +254,8 @@ Reduction ChangeLowering::ChangeTaggedToFloat64(Node* value, Node* control) {
graph()->NewNode(common()->Branch(BranchHint::kFalse), check1, control);
Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1);
Node* vtrue1 =
FLAG_turbo_deoptimization
? graph()->NewNode(value->op(), object, context,
NodeProperties::GetFrameStateInput(value, 0),
effect, if_true1)
: graph()->NewNode(value->op(), object, context, effect, if_true1);
Node* vtrue1 = graph()->NewNode(value->op(), object, context, frame_state,
effect, if_true1);
Node* etrue1 = vtrue1;
{
Node* check2 = TestNotSmi(vtrue1);
......
......@@ -19,14 +19,14 @@ namespace compiler {
void GraphReplayPrinter::PrintReplay(Graph* graph) {
GraphReplayPrinter replay;
PrintF(" Node* nil = graph.NewNode(common_builder.Dead());\n");
PrintF(" Node* nil = graph()->NewNode(common()->Dead());\n");
Zone zone;
AllNodes nodes(&zone, graph);
// Allocate the nodes first.
for (Node* node : nodes.live) {
PrintReplayOpCreator(node->op());
PrintF(" Node* n%d = graph.NewNode(op", node->id());
PrintF(" Node* n%d = graph()->NewNode(op", node->id());
for (int i = 0; i < node->InputCount(); ++i) {
PrintF(", nil");
}
......@@ -45,24 +45,25 @@ void GraphReplayPrinter::PrintReplay(Graph* graph) {
void GraphReplayPrinter::PrintReplayOpCreator(const Operator* op) {
IrOpcode::Value opcode = static_cast<IrOpcode::Value>(op->opcode());
const char* builder =
IrOpcode::IsCommonOpcode(opcode) ? "common_builder" : "js_builder";
const char* builder = IrOpcode::IsCommonOpcode(opcode) ? "common" : "js";
const char* mnemonic = IrOpcode::IsCommonOpcode(opcode)
? IrOpcode::Mnemonic(opcode)
: IrOpcode::Mnemonic(opcode) + 2;
PrintF(" op = %s.%s(", builder, mnemonic);
PrintF(" op = %s()->%s(", builder, mnemonic);
switch (opcode) {
case IrOpcode::kParameter:
case IrOpcode::kNumberConstant:
PrintF("0");
PrintF("%d", ParameterIndexOf(op));
break;
case IrOpcode::kLoad:
PrintF("unique_name");
case IrOpcode::kNumberConstant:
PrintF("%g", OpParameter<double>(op));
break;
case IrOpcode::kHeapConstant:
PrintF("unique_constant");
break;
case IrOpcode::kPhi:
PrintF("kMachAnyTagged, %d", op->ValueInputCount());
break;
case IrOpcode::kStateValues:
PrintF("%d", op->ValueInputCount());
break;
case IrOpcode::kEffectPhi:
......@@ -72,6 +73,12 @@ void GraphReplayPrinter::PrintReplayOpCreator(const Operator* op) {
case IrOpcode::kMerge:
PrintF("%d", op->ControlInputCount());
break;
case IrOpcode::kStart:
PrintF("%d", op->ValueOutputCount() - 3);
break;
case IrOpcode::kFrameState:
PrintF("JS_FRAME, BailoutId(-1), OutputFrameStateCombine::Ignore()");
break;
default:
break;
}
......@@ -79,6 +86,7 @@ void GraphReplayPrinter::PrintReplayOpCreator(const Operator* op) {
}
#endif // DEBUG
}
}
} // namespace v8::internal::compiler
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -69,6 +69,11 @@ class Graph : public ZoneObject {
Node* nodes[] = {n1, n2, n3, n4, n5, n6, n7};
return NewNode(op, arraysize(nodes), nodes);
}
Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4,
Node* n5, Node* n6, Node* n7, Node* n8) {
Node* nodes[] = {n1, n2, n3, n4, n5, n6, n7, n8};
return NewNode(op, arraysize(nodes), nodes);
}
template <class Visitor>
inline void VisitNodeInputsFromEnd(Visitor* visitor);
......
......@@ -1057,8 +1057,6 @@ void InstructionSelector::VisitReturn(Node* value) {
void InstructionSelector::VisitDeoptimize(Node* value) {
DCHECK(FLAG_turbo_deoptimization);
OperandGenerator g(this);
FrameStateDescriptor* desc = GetFrameStateDescriptor(value);
......
......@@ -138,11 +138,7 @@ void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token) {
inputs.push_back(graph()->start());
inputs.push_back(graph()->start());
} else {
DCHECK((OperatorProperties::GetFrameStateInputCount(node->op()) == 1) ==
FLAG_turbo_deoptimization);
if (FLAG_turbo_deoptimization) {
inputs.push_back(NodeProperties::GetFrameStateInput(node, 0));
}
inputs.push_back(NodeProperties::GetFrameStateInput(node, 0));
inputs.push_back(NodeProperties::GetEffectInput(node));
inputs.push_back(NodeProperties::GetControlInput(node));
}
......
......@@ -360,20 +360,18 @@ Reduction JSInliner::Reduce(Node* node) {
Inlinee inlinee(visitor.GetCopy(graph.start()), visitor.GetCopy(graph.end()));
if (FLAG_turbo_deoptimization) {
Node* outer_frame_state = call.frame_state();
// Insert argument adaptor frame if required.
if (call.formal_arguments() != inlinee.formal_parameters()) {
outer_frame_state =
CreateArgumentsAdaptorFrameState(&call, function, info.zone());
}
Node* outer_frame_state = call.frame_state();
// Insert argument adaptor frame if required.
if (call.formal_arguments() != inlinee.formal_parameters()) {
outer_frame_state =
CreateArgumentsAdaptorFrameState(&call, function, info.zone());
}
for (Node* node : visitor.copies()) {
if (node && node->opcode() == IrOpcode::kFrameState) {
DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op()));
AddClosureToFrameState(node, function);
NodeProperties::ReplaceFrameStateInput(node, 0, outer_frame_state);
}
for (Node* node : visitor.copies()) {
if (node && node->opcode() == IrOpcode::kFrameState) {
DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op()));
AddClosureToFrameState(node, function);
NodeProperties::ReplaceFrameStateInput(node, 0, outer_frame_state);
}
}
......
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -13,6 +12,7 @@
#include "src/compiler/linkage.h"
#include "src/compiler/node-matchers.h"
#include "src/compiler/node-properties.h"
#include "src/compiler/operator-properties.h"
namespace v8 {
namespace internal {
......@@ -114,8 +114,9 @@ Reduction JSIntrinsicLowering::ReduceCreateArrayLiteral(Node* node) {
Callable callable = CodeFactory::FastCloneShallowArray(isolate);
CallDescriptor* desc = Linkage::GetStubCallDescriptor(
isolate, graph()->zone(), callable.descriptor(), 0,
FLAG_turbo_deoptimization ? CallDescriptor::kNeedsFrameState
: CallDescriptor::kNoFlags);
(OperatorProperties::GetFrameStateInputCount(node->op()) != 0)
? CallDescriptor::kNeedsFrameState
: CallDescriptor::kNoFlags);
const Operator* new_op = common()->Call(desc);
Node* stub_code = jsgraph()->HeapConstant(callable.code());
node->RemoveInput(3); // Remove flags input from node.
......@@ -143,8 +144,9 @@ Reduction JSIntrinsicLowering::ReduceCreateObjectLiteral(Node* node) {
Callable callable = CodeFactory::FastCloneShallowObject(isolate, length);
CallDescriptor* desc = Linkage::GetStubCallDescriptor(
isolate, graph()->zone(), callable.descriptor(), 0,
FLAG_turbo_deoptimization ? CallDescriptor::kNeedsFrameState
: CallDescriptor::kNoFlags);
(OperatorProperties::GetFrameStateInputCount(node->op()) != 0)
? CallDescriptor::kNeedsFrameState
: CallDescriptor::kNoFlags);
const Operator* new_op = common()->Call(desc);
Node* stub_code = jsgraph()->HeapConstant(callable.code());
node->InsertInput(graph()->zone(), 0, stub_code);
......@@ -157,6 +159,7 @@ Reduction JSIntrinsicLowering::ReduceCreateObjectLiteral(Node* node) {
Reduction JSIntrinsicLowering::ReduceDeoptimizeNow(Node* node) {
// TODO(jarin): This should not depend on the global flag.
if (!FLAG_turbo_deoptimization) return NoChange();
Node* frame_state = NodeProperties::GetFrameStateInput(node, 0);
......
......@@ -61,11 +61,9 @@ Reduction JSTypeFeedbackSpecializer::Reduce(Node* node) {
// StoreProperty(o, "constant", v) => StoreNamed["constant"](o, v).
Unique<Name> name = match.Value();
LanguageMode language_mode = OpParameter<LanguageMode>(node);
if (FLAG_turbo_deoptimization) {
// StoreProperty has 2 frame state inputs, but StoreNamed only 1.
DCHECK_EQ(2, OperatorProperties::GetFrameStateInputCount(node->op()));
node->RemoveInput(NodeProperties::FirstFrameStateIndex(node) + 1);
}
// 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(
jsgraph()->javascript()->StoreNamed(language_mode, name, KEYED));
node->RemoveInput(1);
......@@ -148,8 +146,6 @@ static bool GetInObjectFieldAccess(LoadOrStore mode, Handle<Map> map,
Reduction JSTypeFeedbackSpecializer::ReduceJSLoadNamed(Node* node) {
DCHECK(node->opcode() == IrOpcode::kJSLoadNamed);
// TODO(turbofan): type feedback currently requires deoptimization.
if (!FLAG_turbo_deoptimization) return NoChange();
// TODO(titzer): deopt locations are wrong for property accesses
if (!EAGER_DEOPT_LOCATIONS_FOR_PROPERTY_ACCESS_ARE_CORRECT) return NoChange();
......@@ -202,8 +198,6 @@ Reduction JSTypeFeedbackSpecializer::ReduceJSLoadProperty(Node* node) {
Reduction JSTypeFeedbackSpecializer::ReduceJSStoreNamed(Node* node) {
DCHECK(node->opcode() == IrOpcode::kJSStoreNamed);
// TODO(turbofan): type feedback currently requires deoptimization.
if (!FLAG_turbo_deoptimization) return NoChange();
// TODO(titzer): deopt locations are wrong for property accesses
if (!EAGER_DEOPT_LOCATIONS_FOR_PROPERTY_ACCESS_ARE_CORRECT) return NoChange();
......
......@@ -211,10 +211,14 @@ class JSBinopReduction final {
}
Node* CreateFrameStateForLeftInput(Node* frame_state) {
if (!FLAG_turbo_deoptimization) return nullptr;
FrameStateCallInfo state_info =
OpParameter<FrameStateCallInfo>(frame_state);
if (state_info.bailout_id() == BailoutId::None()) {
// Dummy frame state => just leave it as is.
return frame_state;
}
// If the frame state is already the right one, just return it.
if (state_info.state_combine().kind() == OutputFrameStateCombine::kPokeAt &&
state_info.state_combine().GetOffsetToPokeAt() == 1) {
......@@ -234,8 +238,6 @@ class JSBinopReduction final {
}
Node* CreateFrameStateForRightInput(Node* frame_state, Node* converted_left) {
if (!FLAG_turbo_deoptimization) return nullptr;
FrameStateCallInfo state_info =
OpParameter<FrameStateCallInfo>(frame_state);
......@@ -279,13 +281,6 @@ class JSBinopReduction final {
Node* ConvertToNumber(Node* node, Node* frame_state) {
if (NodeProperties::GetBounds(node).upper->Is(Type::PlainPrimitive())) {
return ConvertPrimitiveToNumber(node);
} else if (!FLAG_turbo_deoptimization) {
// We cannot use ConvertToPrimitiveNumber here because we need context
// for converting general values.
Node* const n = graph()->NewNode(javascript()->ToNumber(), node,
context(), effect(), control());
update_effect(n);
return n;
} else {
Node* const n =
graph()->NewNode(javascript()->ToNumber(), node, context(),
......@@ -325,9 +320,7 @@ Reduction JSTypedLowering::ReduceJSAdd(Node* node) {
}
if (r.NeitherInputCanBe(Type::StringOrReceiver())) {
// JSAdd(x:-string, y:-string) => NumberAdd(ToNumber(x), ToNumber(y))
Node* frame_state = FLAG_turbo_deoptimization
? NodeProperties::GetFrameStateInput(node, 1)
: nullptr;
Node* frame_state = NodeProperties::GetFrameStateInput(node, 1);
r.ConvertInputsToNumber(frame_state);
return r.ChangeToPureOperator(simplified()->NumberAdd(), Type::Number());
}
......@@ -351,9 +344,7 @@ Reduction JSTypedLowering::ReduceJSAdd(Node* node) {
Reduction JSTypedLowering::ReduceNumberBinop(Node* node,
const Operator* numberOp) {
JSBinopReduction r(this, node);
Node* frame_state = FLAG_turbo_deoptimization
? NodeProperties::GetFrameStateInput(node, 1)
: nullptr;
Node* frame_state = NodeProperties::GetFrameStateInput(node, 1);
r.ConvertInputsToNumber(frame_state);
return r.ChangeToPureOperator(numberOp, Type::Number());
}
......@@ -361,9 +352,7 @@ Reduction JSTypedLowering::ReduceNumberBinop(Node* node,
Reduction JSTypedLowering::ReduceInt32Binop(Node* node, const Operator* intOp) {
JSBinopReduction r(this, node);
Node* frame_state = FLAG_turbo_deoptimization
? NodeProperties::GetFrameStateInput(node, 1)
: nullptr;
Node* frame_state = NodeProperties::GetFrameStateInput(node, 1);
r.ConvertInputsToNumber(frame_state);
r.ConvertInputsToUI32(kSigned, kSigned);
return r.ChangeToPureOperator(intOp, Type::Integral32());
......@@ -700,11 +689,9 @@ Reduction JSTypedLowering::ReduceJSToNumber(Node* node) {
NodeProperties::ReplaceContextInput(node, jsgraph()->NoContextConstant());
NodeProperties::ReplaceControlInput(node, graph()->start());
NodeProperties::ReplaceEffectInput(node, graph()->start());
if (FLAG_turbo_deoptimization) {
DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op()));
NodeProperties::ReplaceFrameStateInput(node, 0,
jsgraph()->EmptyFrameState());
}
DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op()));
NodeProperties::ReplaceFrameStateInput(node, 0,
jsgraph()->EmptyFrameState());
return Changed(node);
}
}
......@@ -841,19 +828,11 @@ Reduction JSTypedLowering::ReduceJSStoreProperty(Node* node) {
if (number_reduction.Changed()) {
value = number_reduction.replacement();
} else {
DCHECK(FLAG_turbo_deoptimization ==
(OperatorProperties::GetFrameStateInputCount(
javascript()->ToNumber()) == 1));
if (FLAG_turbo_deoptimization) {
Node* frame_state_for_to_number =
NodeProperties::GetFrameStateInput(node, 1);
value = effect =
graph()->NewNode(javascript()->ToNumber(), value, context,
frame_state_for_to_number, effect, control);
} else {
value = effect = graph()->NewNode(javascript()->ToNumber(), value,
context, effect, control);
}
Node* frame_state_for_to_number =
NodeProperties::GetFrameStateInput(node, 1);
value = effect =
graph()->NewNode(javascript()->ToNumber(), value, context,
frame_state_for_to_number, effect, control);
}
}
// For integer-typed arrays, convert to the integer type.
......@@ -1036,15 +1015,9 @@ Node* JSTypedLowering::ConvertPrimitiveToNumber(Node* input) {
Reduction const reduction = ReduceJSToNumberInput(input);
if (reduction.Changed()) return reduction.replacement();
// TODO(jarin) Use PlainPrimitiveToNumber once we have it.
Node* const conversion =
FLAG_turbo_deoptimization
? graph()->NewNode(javascript()->ToNumber(), input,
jsgraph()->NoContextConstant(),
jsgraph()->EmptyFrameState(), graph()->start(),
graph()->start())
: graph()->NewNode(javascript()->ToNumber(), input,
jsgraph()->NoContextConstant(), graph()->start(),
graph()->start());
Node* const conversion = graph()->NewNode(
javascript()->ToNumber(), input, jsgraph()->NoContextConstant(),
jsgraph()->EmptyFrameState(), graph()->start(), graph()->start());
InsertConversion(conversion);
return conversion;
}
......
......@@ -96,10 +96,6 @@ FrameOffset Linkage::GetFrameOffset(int spill_slot, Frame* frame,
// static
bool Linkage::NeedsFrameState(Runtime::FunctionId function) {
if (!FLAG_turbo_deoptimization) {
return false;
}
// Most runtime functions need a FrameState. A few chosen ones that we know
// not to call into arbitrary JavaScript, not to throw, and not to deoptimize
// are blacklisted here and can be called without a FrameState.
......
......@@ -21,9 +21,6 @@ bool OperatorProperties::HasContextInput(const Operator* op) {
// static
int OperatorProperties::GetFrameStateInputCount(const Operator* op) {
if (!FLAG_turbo_deoptimization) {
return 0;
}
switch (op->opcode()) {
case IrOpcode::kFrameState:
return 1;
......
......@@ -1042,7 +1042,9 @@ Handle<Code> Pipeline::GenerateCode() {
RunPrintAndVerify("OSR deconstruction");
}
if (info()->is_type_feedback_enabled()) {
// TODO(turbofan): Type feedback currently requires deoptimization.
if (info()->is_deoptimization_enabled() &&
info()->is_type_feedback_enabled()) {
Run<JSTypeFeedbackPhase>();
RunPrintAndVerify("JSType feedback");
}
......
......@@ -76,11 +76,8 @@ TEST_F(ControlFlowOptimizerTest, BuildSwitch1) {
TEST_F(ControlFlowOptimizerTest, BuildSwitch2) {
Node* input = Parameter(0);
Node* context = Parameter(1);
Node* index = FLAG_turbo_deoptimization
? graph()->NewNode(javascript()->ToNumber(), input, context,
EmptyFrameState(), start(), start())
: graph()->NewNode(javascript()->ToNumber(), input, context,
start(), start());
Node* index = graph()->NewNode(javascript()->ToNumber(), input, context,
EmptyFrameState(), start(), start());
Node* if_success = graph()->NewNode(common()->IfSuccess(), index);
Node* branch0 = graph()->NewNode(
common()->Branch(),
......
......@@ -38,6 +38,12 @@ class JSIntrinsicLoweringTest : public GraphTest {
return reducer.Reduce(node);
}
Node* EmptyFrameState() {
MachineOperatorBuilder machine(zone());
JSGraph jsgraph(isolate(), graph(), common(), javascript(), &machine);
return jsgraph.EmptyFrameState();
}
JSOperatorBuilder* javascript() { return &javascript_; }
private:
......@@ -71,23 +77,23 @@ TEST_F(JSIntrinsicLoweringTest, InlineOptimizedConstructDouble) {
TEST_F(JSIntrinsicLoweringTest, InlineCreateArrayLiteral) {
i::FLAG_turbo_deoptimization = false;
Node* const input0 = Parameter(0);
Node* const input1 = Parameter(1);
Node* const input2 = HeapConstant(factory()->NewFixedArray(12));
Node* const input3 = NumberConstant(ArrayLiteral::kShallowElements);
Node* const context = Parameter(2);
Node* const frame_state = EmptyFrameState();
Node* const effect = graph()->start();
Node* const control = graph()->start();
Reduction const r = Reduce(graph()->NewNode(
javascript()->CallRuntime(Runtime::kInlineCreateArrayLiteral, 4), input0,
input1, input2, input3, context, effect, control));
input1, input2, input3, context, frame_state, effect, control));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(
r.replacement(),
IsCall(_, IsHeapConstant(Unique<HeapObject>::CreateImmovable(
CodeFactory::FastCloneShallowArray(isolate()).code())),
input0, input1, input2, effect, control));
input0, input1, input2, context, frame_state, effect, control));
}
......@@ -96,23 +102,24 @@ TEST_F(JSIntrinsicLoweringTest, InlineCreateArrayLiteral) {
TEST_F(JSIntrinsicLoweringTest, InlineCreateObjectLiteral) {
i::FLAG_turbo_deoptimization = false;
Node* const input0 = Parameter(0);
Node* const input1 = Parameter(1);
Node* const input2 = HeapConstant(factory()->NewFixedArray(2 * 6));
Node* const input3 = NumberConstant(ObjectLiteral::kShallowProperties);
Node* const context = Parameter(2);
Node* const frame_state = EmptyFrameState();
Node* const effect = graph()->start();
Node* const control = graph()->start();
Reduction const r = Reduce(graph()->NewNode(
javascript()->CallRuntime(Runtime::kInlineCreateObjectLiteral, 4), input0,
input1, input2, input3, context, effect, control));
input1, input2, input3, context, frame_state, effect, control));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(
r.replacement(),
IsCall(_, IsHeapConstant(Unique<HeapObject>::CreateImmovable(
CodeFactory::FastCloneShallowObject(isolate(), 6).code())),
input0, input1, input2, effect, control));
input0, input1, input2, input3, context, frame_state, effect,
control));
}
......
......@@ -107,17 +107,14 @@ TEST_P(JSSharedOperatorTest, NumberOfInputsAndOutputs) {
const Operator* op = (javascript.*sop.constructor)();
const int context_input_count = 1;
// TODO(jarin): Get rid of this hack.
const int frame_state_input_count =
FLAG_turbo_deoptimization ? sop.frame_state_input_count : 0;
EXPECT_EQ(sop.value_input_count, op->ValueInputCount());
EXPECT_EQ(context_input_count, OperatorProperties::GetContextInputCount(op));
EXPECT_EQ(frame_state_input_count,
EXPECT_EQ(sop.frame_state_input_count,
OperatorProperties::GetFrameStateInputCount(op));
EXPECT_EQ(sop.effect_input_count, op->EffectInputCount());
EXPECT_EQ(sop.control_input_count, op->ControlInputCount());
EXPECT_EQ(sop.value_input_count + context_input_count +
frame_state_input_count + sop.effect_input_count +
sop.frame_state_input_count + sop.effect_input_count +
sop.control_input_count,
OperatorProperties::GetTotalInputCount(op));
......@@ -169,16 +166,12 @@ TEST_P(JSStorePropertyOperatorTest, NumberOfInputsAndOutputs) {
const LanguageMode mode = GetParam();
const Operator* op = javascript.StoreProperty(mode);
// TODO(jarin): Get rid of this hack.
const int frame_state_input_count = FLAG_turbo_deoptimization ? 2 : 0;
EXPECT_EQ(3, op->ValueInputCount());
EXPECT_EQ(1, OperatorProperties::GetContextInputCount(op));
EXPECT_EQ(frame_state_input_count,
OperatorProperties::GetFrameStateInputCount(op));
EXPECT_EQ(2, OperatorProperties::GetFrameStateInputCount(op));
EXPECT_EQ(1, op->EffectInputCount());
EXPECT_EQ(1, op->ControlInputCount());
EXPECT_EQ(6 + frame_state_input_count,
OperatorProperties::GetTotalInputCount(op));
EXPECT_EQ(8, OperatorProperties::GetTotalInputCount(op));
EXPECT_EQ(0, op->ValueOutputCount());
EXPECT_EQ(1, op->EffectOutputCount());
......
......@@ -417,11 +417,8 @@ TEST_F(JSTypedLoweringTest, JSToNumberWithPlainPrimitive) {
Node* const effect = graph()->start();
Node* const control = graph()->start();
Reduction r =
FLAG_turbo_deoptimization
? Reduce(graph()->NewNode(javascript()->ToNumber(), input, context,
EmptyFrameState(), effect, control))
: Reduce(graph()->NewNode(javascript()->ToNumber(), input, context,
effect, control));
Reduce(graph()->NewNode(javascript()->ToNumber(), input, context,
EmptyFrameState(), effect, control));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsToNumber(input, IsNumberConstant(BitEq(0.0)),
graph()->start(), control));
......@@ -639,14 +636,9 @@ TEST_F(JSTypedLoweringTest, JSLoadPropertyFromExternalTypedArray) {
Node* context = UndefinedConstant();
Node* effect = graph()->start();
Node* control = graph()->start();
Node* node = graph()->NewNode(javascript()->LoadProperty(feedback), base,
key, context);
if (FLAG_turbo_deoptimization) {
node->AppendInput(zone(), UndefinedConstant());
}
node->AppendInput(zone(), effect);
node->AppendInput(zone(), control);
Reduction r = Reduce(node);
Reduction r =
Reduce(graph()->NewNode(javascript()->LoadProperty(feedback), base, key,
context, EmptyFrameState(), effect, control));
Matcher<Node*> offset_matcher =
element_size == 1
......@@ -685,14 +677,9 @@ TEST_F(JSTypedLoweringTest, JSLoadPropertyFromExternalTypedArrayWithSafeKey) {
Node* context = UndefinedConstant();
Node* effect = graph()->start();
Node* control = graph()->start();
Node* node = graph()->NewNode(javascript()->LoadProperty(feedback), base,
key, context);
if (FLAG_turbo_deoptimization) {
node->AppendInput(zone(), UndefinedConstant());
}
node->AppendInput(zone(), effect);
node->AppendInput(zone(), control);
Reduction r = Reduce(node);
Reduction r =
Reduce(graph()->NewNode(javascript()->LoadProperty(feedback), base, key,
context, EmptyFrameState(), effect, control));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(
......@@ -875,16 +862,11 @@ TEST_F(JSTypedLoweringTest, JSLoadNamedGlobalConstants) {
for (size_t i = 0; i < arraysize(names); i++) {
Unique<Name> name = Unique<Name>::CreateImmovable(names[i]);
Node* node = graph()->NewNode(javascript()->LoadNamed(name, feedback),
global, context);
if (FLAG_turbo_deoptimization) {
node->AppendInput(zone(), EmptyFrameState());
}
node->AppendInput(zone(), effect);
node->AppendInput(zone(), control);
Reduction r = Reduce(node);
Reduction r =
Reduce(graph()->NewNode(javascript()->LoadNamed(name, feedback), global,
context, EmptyFrameState(), effect, control));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), matches[i]);
}
}
......
This diff is collapsed.
......@@ -98,8 +98,25 @@ Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher,
const Matcher<Node*>& value1_matcher,
const Matcher<Node*>& value2_matcher,
const Matcher<Node*>& value3_matcher,
const Matcher<Node*>& value4_matcher,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher);
Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher,
const Matcher<Node*>& value0_matcher,
const Matcher<Node*>& value1_matcher,
const Matcher<Node*>& value2_matcher,
const Matcher<Node*>& value3_matcher,
const Matcher<Node*>& value4_matcher,
const Matcher<Node*>& value5_matcher,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher);
Matcher<Node*> IsCall(
const Matcher<CallDescriptor*>& descriptor_matcher,
const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
const Matcher<Node*>& value2_matcher, const Matcher<Node*>& value3_matcher,
const Matcher<Node*>& value4_matcher, const Matcher<Node*>& value5_matcher,
const Matcher<Node*>& value6_matcher, const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher);
Matcher<Node*> IsBooleanNot(const Matcher<Node*>& value_matcher);
Matcher<Node*> IsNumberEqual(const Matcher<Node*>& lhs_matcher,
......
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