Commit c602a91c authored by machenbach's avatar machenbach Committed by Commit bot

Revert of [turbofan] Checking of input counts on node creation (patchset #4...

Revert of [turbofan] Checking of input counts on node creation (patchset #4 id:60001 of https://codereview.chromium.org/1347353003/ )

Reason for revert:
[Sheriff] Breaks mips cross-compile:
http://build.chromium.org/p/client.v8/builders/V8%20Mips%20-%20builder/builds/4315

Original issue's description:
> [turbofan] Checking of input counts on node creation
>
> This required fixing bunch of tests with wrong input counts.
>
> Committed: https://crrev.com/260ec46efd74c45cdc4b156d95086b7de06621ad
> Cr-Commit-Position: refs/heads/master@{#30877}

TBR=bmeurer@chromium.org,mstarzinger@chromium.org,jarin@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

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

Cr-Commit-Position: refs/heads/master@{#30878}
parent 260ec46e
...@@ -81,12 +81,11 @@ BasicBlockProfiler::Data* BasicBlockInstrumentor::Instrument( ...@@ -81,12 +81,11 @@ BasicBlockProfiler::Data* BasicBlockInstrumentor::Instrument(
// Construct increment operation. // Construct increment operation.
Node* base = graph->NewNode( Node* base = graph->NewNode(
PointerConstant(&common, data->GetCounterAddress(block_number))); PointerConstant(&common, data->GetCounterAddress(block_number)));
Node* load = graph->NewNode(machine.Load(kMachUint32), base, zero, Node* load = graph->NewNode(machine.Load(kMachUint32), base, zero);
graph->start(), graph->start());
Node* inc = graph->NewNode(machine.Int32Add(), load, one); Node* inc = graph->NewNode(machine.Int32Add(), load, one);
Node* store = graph->NewNode( Node* store = graph->NewNode(
machine.Store(StoreRepresentation(kMachUint32, kNoWriteBarrier)), base, machine.Store(StoreRepresentation(kMachUint32, kNoWriteBarrier)), base,
zero, inc, graph->start(), graph->start()); zero, inc);
// Insert the new nodes. // Insert the new nodes.
static const int kArraySize = 6; static const int kArraySize = 6;
Node* to_insert[kArraySize] = {zero, one, base, load, inc, store}; Node* to_insert[kArraySize] = {zero, one, base, load, inc, store};
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "src/base/bits.h" #include "src/base/bits.h"
#include "src/compiler/node.h" #include "src/compiler/node.h"
#include "src/compiler/operator-properties.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -44,13 +43,7 @@ void Graph::RemoveDecorator(GraphDecorator* decorator) { ...@@ -44,13 +43,7 @@ void Graph::RemoveDecorator(GraphDecorator* decorator) {
Node* Graph::NewNode(const Operator* op, int input_count, Node** inputs, Node* Graph::NewNode(const Operator* op, int input_count, Node** inputs,
bool incomplete) { bool incomplete) {
DCHECK_EQ(OperatorProperties::GetTotalInputCount(op), input_count); DCHECK_LE(op->ValueInputCount(), input_count);
return NewNodeUnchecked(op, input_count, inputs, incomplete);
}
Node* Graph::NewNodeUnchecked(const Operator* op, int input_count,
Node** inputs, bool incomplete) {
Node* const node = Node* const node =
Node::New(zone(), NextNodeId(), op, input_count, inputs, incomplete); Node::New(zone(), NextNodeId(), op, input_count, inputs, incomplete);
Decorate(node); Decorate(node);
......
...@@ -34,10 +34,6 @@ class Graph : public ZoneObject { ...@@ -34,10 +34,6 @@ class Graph : public ZoneObject {
explicit Graph(Zone* zone); explicit Graph(Zone* zone);
// Base implementation used by all factory methods. // Base implementation used by all factory methods.
Node* NewNodeUnchecked(const Operator* op, int input_count, Node** inputs,
bool incomplete = false);
// Factory that checks the input count.
Node* NewNode(const Operator* op, int input_count, Node** inputs, Node* NewNode(const Operator* op, int input_count, Node** inputs,
bool incomplete = false); bool incomplete = false);
......
...@@ -32,7 +32,7 @@ RawMachineAssembler::RawMachineAssembler(Isolate* isolate, Graph* graph, ...@@ -32,7 +32,7 @@ RawMachineAssembler::RawMachineAssembler(Isolate* isolate, Graph* graph,
parameters_ = zone()->NewArray<Node*>(param_count); parameters_ = zone()->NewArray<Node*>(param_count);
for (size_t i = 0; i < parameter_count(); ++i) { for (size_t i = 0; i < parameter_count(); ++i) {
parameters_[i] = parameters_[i] =
AddNode(common()->Parameter(static_cast<int>(i)), graph->start()); NewNode(common()->Parameter(static_cast<int>(i)), graph->start());
} }
} }
...@@ -64,7 +64,7 @@ void RawMachineAssembler::Goto(Label* label) { ...@@ -64,7 +64,7 @@ void RawMachineAssembler::Goto(Label* label) {
void RawMachineAssembler::Branch(Node* condition, Label* true_val, void RawMachineAssembler::Branch(Node* condition, Label* true_val,
Label* false_val) { Label* false_val) {
DCHECK(current_block_ != schedule()->end()); DCHECK(current_block_ != schedule()->end());
Node* branch = AddNode(common()->Branch(), condition); Node* branch = NewNode(common()->Branch(), condition);
schedule()->AddBranch(CurrentBlock(), branch, Use(true_val), Use(false_val)); schedule()->AddBranch(CurrentBlock(), branch, Use(true_val), Use(false_val));
current_block_ = nullptr; current_block_ = nullptr;
} }
...@@ -75,7 +75,7 @@ void RawMachineAssembler::Switch(Node* index, Label* default_label, ...@@ -75,7 +75,7 @@ void RawMachineAssembler::Switch(Node* index, Label* default_label,
size_t case_count) { size_t case_count) {
DCHECK_NE(schedule()->end(), current_block_); DCHECK_NE(schedule()->end(), current_block_);
size_t succ_count = case_count + 1; size_t succ_count = case_count + 1;
Node* switch_node = AddNode(common()->Switch(succ_count), index); Node* switch_node = NewNode(common()->Switch(succ_count), index);
BasicBlock** succ_blocks = zone()->NewArray<BasicBlock*>(succ_count); BasicBlock** succ_blocks = zone()->NewArray<BasicBlock*>(succ_count);
for (size_t index = 0; index < case_count; ++index) { for (size_t index = 0; index < case_count; ++index) {
int32_t case_value = case_values[index]; int32_t case_value = case_values[index];
...@@ -95,7 +95,7 @@ void RawMachineAssembler::Switch(Node* index, Label* default_label, ...@@ -95,7 +95,7 @@ void RawMachineAssembler::Switch(Node* index, Label* default_label,
void RawMachineAssembler::Return(Node* value) { void RawMachineAssembler::Return(Node* value) {
Node* ret = MakeNode(common()->Return(), 1, &value); Node* ret = graph()->NewNode(common()->Return(), value);
schedule()->AddReturn(CurrentBlock(), ret); schedule()->AddReturn(CurrentBlock(), ret);
current_block_ = nullptr; current_block_ = nullptr;
} }
...@@ -114,7 +114,9 @@ Node* RawMachineAssembler::CallN(CallDescriptor* desc, Node* function, ...@@ -114,7 +114,9 @@ Node* RawMachineAssembler::CallN(CallDescriptor* desc, Node* function,
} }
buffer[index++] = graph()->start(); buffer[index++] = graph()->start();
buffer[index++] = graph()->start(); buffer[index++] = graph()->start();
return AddNode(common()->Call(desc), input_count, buffer); Node* call = graph()->NewNode(common()->Call(desc), input_count, buffer);
schedule()->AddNode(CurrentBlock(), call);
return call;
} }
...@@ -134,7 +136,9 @@ Node* RawMachineAssembler::CallNWithFrameState(CallDescriptor* desc, ...@@ -134,7 +136,9 @@ Node* RawMachineAssembler::CallNWithFrameState(CallDescriptor* desc,
buffer[index++] = frame_state; buffer[index++] = frame_state;
buffer[index++] = graph()->start(); buffer[index++] = graph()->start();
buffer[index++] = graph()->start(); buffer[index++] = graph()->start();
return AddNode(common()->Call(desc), input_count, buffer); Node* call = graph()->NewNode(common()->Call(desc), input_count, buffer);
schedule()->AddNode(CurrentBlock(), call);
return call;
} }
...@@ -151,7 +155,8 @@ Node* RawMachineAssembler::TailCallN(CallDescriptor* desc, Node* function, ...@@ -151,7 +155,8 @@ Node* RawMachineAssembler::TailCallN(CallDescriptor* desc, Node* function,
} }
buffer[index++] = graph()->start(); buffer[index++] = graph()->start();
buffer[index++] = graph()->start(); buffer[index++] = graph()->start();
Node* tail_call = MakeNode(common()->TailCall(desc), input_count, buffer); Node* tail_call =
graph()->NewNode(common()->TailCall(desc), input_count, buffer);
schedule()->AddTailCall(CurrentBlock(), tail_call); schedule()->AddTailCall(CurrentBlock(), tail_call);
return tail_call; return tail_call;
} }
...@@ -165,8 +170,11 @@ Node* RawMachineAssembler::CallFunctionStub0(Node* function, Node* receiver, ...@@ -165,8 +170,11 @@ Node* RawMachineAssembler::CallFunctionStub0(Node* function, Node* receiver,
isolate(), zone(), callable.descriptor(), 1, isolate(), zone(), callable.descriptor(), 1,
CallDescriptor::kNeedsFrameState, Operator::kNoProperties); CallDescriptor::kNeedsFrameState, Operator::kNoProperties);
Node* stub_code = HeapConstant(callable.code()); Node* stub_code = HeapConstant(callable.code());
return AddNode(common()->Call(desc), stub_code, function, receiver, context, Node* call = graph()->NewNode(common()->Call(desc), stub_code, function,
frame_state, graph()->start(), graph()->start()); receiver, context, frame_state,
graph()->start(), graph()->start());
schedule()->AddNode(CurrentBlock(), call);
return call;
} }
...@@ -176,12 +184,15 @@ Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function, ...@@ -176,12 +184,15 @@ Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function,
zone(), function, 1, Operator::kNoProperties, false); zone(), function, 1, Operator::kNoProperties, false);
Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode()); Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode());
Node* ref = AddNode( Node* ref = NewNode(
common()->ExternalConstant(ExternalReference(function, isolate()))); common()->ExternalConstant(ExternalReference(function, isolate())));
Node* arity = Int32Constant(1); Node* arity = Int32Constant(1);
return AddNode(common()->Call(descriptor), centry, arg1, ref, arity, context, Node* call =
graph()->start(), graph()->start()); graph()->NewNode(common()->Call(descriptor), centry, arg1, ref, arity,
context, graph()->start(), graph()->start());
schedule()->AddNode(CurrentBlock(), call);
return call;
} }
...@@ -191,12 +202,15 @@ Node* RawMachineAssembler::CallRuntime2(Runtime::FunctionId function, ...@@ -191,12 +202,15 @@ Node* RawMachineAssembler::CallRuntime2(Runtime::FunctionId function,
zone(), function, 2, Operator::kNoProperties, false); zone(), function, 2, Operator::kNoProperties, false);
Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode()); Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode());
Node* ref = AddNode( Node* ref = NewNode(
common()->ExternalConstant(ExternalReference(function, isolate()))); common()->ExternalConstant(ExternalReference(function, isolate())));
Node* arity = Int32Constant(2); Node* arity = Int32Constant(2);
return AddNode(common()->Call(descriptor), centry, arg1, arg2, ref, arity, Node* call =
context, graph()->start(), graph()->start()); graph()->NewNode(common()->Call(descriptor), centry, arg1, arg2, ref,
arity, context, graph()->start(), graph()->start());
schedule()->AddNode(CurrentBlock(), call);
return call;
} }
...@@ -207,8 +221,10 @@ Node* RawMachineAssembler::CallCFunction0(MachineType return_type, ...@@ -207,8 +221,10 @@ Node* RawMachineAssembler::CallCFunction0(MachineType return_type,
const CallDescriptor* descriptor = const CallDescriptor* descriptor =
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build()); Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
return AddNode(common()->Call(descriptor), function, graph()->start(), Node* call = graph()->NewNode(common()->Call(descriptor), function,
graph()->start()); graph()->start(), graph()->start());
schedule()->AddNode(CurrentBlock(), call);
return call;
} }
...@@ -221,8 +237,10 @@ Node* RawMachineAssembler::CallCFunction1(MachineType return_type, ...@@ -221,8 +237,10 @@ Node* RawMachineAssembler::CallCFunction1(MachineType return_type,
const CallDescriptor* descriptor = const CallDescriptor* descriptor =
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build()); Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
return AddNode(common()->Call(descriptor), function, arg0, graph()->start(), Node* call = graph()->NewNode(common()->Call(descriptor), function, arg0,
graph()->start()); graph()->start(), graph()->start());
schedule()->AddNode(CurrentBlock(), call);
return call;
} }
...@@ -237,8 +255,10 @@ Node* RawMachineAssembler::CallCFunction2(MachineType return_type, ...@@ -237,8 +255,10 @@ Node* RawMachineAssembler::CallCFunction2(MachineType return_type,
const CallDescriptor* descriptor = const CallDescriptor* descriptor =
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build()); Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
return AddNode(common()->Call(descriptor), function, arg0, arg1, Node* call = graph()->NewNode(common()->Call(descriptor), function, arg0,
graph()->start(), graph()->start()); arg1, graph()->start(), graph()->start());
schedule()->AddNode(CurrentBlock(), call);
return call;
} }
...@@ -271,7 +291,10 @@ Node* RawMachineAssembler::CallCFunction8( ...@@ -271,7 +291,10 @@ Node* RawMachineAssembler::CallCFunction8(
graph()->start()}; graph()->start()};
const CallDescriptor* descriptor = const CallDescriptor* descriptor =
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build()); Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
return AddNode(common()->Call(descriptor), arraysize(args), args); Node* call =
graph()->NewNode(common()->Call(descriptor), arraysize(args), args);
schedule()->AddNode(CurrentBlock(), call);
return call;
} }
...@@ -301,23 +324,15 @@ BasicBlock* RawMachineAssembler::CurrentBlock() { ...@@ -301,23 +324,15 @@ BasicBlock* RawMachineAssembler::CurrentBlock() {
} }
Node* RawMachineAssembler::AddNode(const Operator* op, int input_count, Node* RawMachineAssembler::MakeNode(const Operator* op, int input_count,
Node** inputs) { Node** inputs) {
DCHECK_NOT_NULL(schedule_); DCHECK_NOT_NULL(schedule_);
DCHECK(current_block_ != nullptr); DCHECK(current_block_ != nullptr);
Node* node = MakeNode(op, input_count, inputs); Node* node = graph()->NewNode(op, input_count, inputs);
schedule()->AddNode(CurrentBlock(), node); schedule()->AddNode(CurrentBlock(), node);
return node; return node;
} }
Node* RawMachineAssembler::MakeNode(const Operator* op, int input_count,
Node** inputs) {
// The raw machine assembler nodes do not have effect and control inputs,
// so we disable checking input counts here.
return graph()->NewNodeUnchecked(op, input_count, inputs);
}
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
This diff is collapsed.
...@@ -266,12 +266,9 @@ class RepresentationSelector { ...@@ -266,12 +266,9 @@ class RepresentationSelector {
// Helper for binops of the R x L -> O variety. // Helper for binops of the R x L -> O variety.
void VisitBinop(Node* node, MachineTypeUnion left_use, void VisitBinop(Node* node, MachineTypeUnion left_use,
MachineTypeUnion right_use, MachineTypeUnion output) { MachineTypeUnion right_use, MachineTypeUnion output) {
DCHECK_EQ(2, node->op()->ValueInputCount()); DCHECK_EQ(2, node->InputCount());
ProcessInput(node, 0, left_use); ProcessInput(node, 0, left_use);
ProcessInput(node, 1, right_use); ProcessInput(node, 1, right_use);
for (int i = 2; i < node->InputCount(); i++) {
Enqueue(node->InputAt(i));
}
SetOutput(node, output); SetOutput(node, output);
} }
......
...@@ -207,7 +207,7 @@ class CompareWrapper { ...@@ -207,7 +207,7 @@ class CompareWrapper {
explicit CompareWrapper(IrOpcode::Value op) : opcode(op) {} explicit CompareWrapper(IrOpcode::Value op) : opcode(op) {}
Node* MakeNode(RawMachineAssemblerTester<int32_t>* m, Node* a, Node* b) { Node* MakeNode(RawMachineAssemblerTester<int32_t>* m, Node* a, Node* b) {
return m->AddNode(op(m->machine()), a, b); return m->NewNode(op(m->machine()), a, b);
} }
const Operator* op(MachineOperatorBuilder* machine) { const Operator* op(MachineOperatorBuilder* machine) {
......
...@@ -20,10 +20,8 @@ ...@@ -20,10 +20,8 @@
using namespace v8::internal; using namespace v8::internal;
using namespace v8::internal::compiler; using namespace v8::internal::compiler;
static Operator dummy_operator1(IrOpcode::kParameter, Operator::kNoWrite, static Operator dummy_operator(IrOpcode::kParameter, Operator::kNoWrite,
"dummy", 1, 0, 0, 1, 0, 0); "dummy", 0, 0, 0, 1, 0, 0);
static Operator dummy_operator6(IrOpcode::kParameter, Operator::kNoWrite,
"dummy", 6, 0, 0, 1, 0, 0);
TEST(NodeWithNullInputReachableFromEnd) { TEST(NodeWithNullInputReachableFromEnd) {
...@@ -108,18 +106,18 @@ TEST(NodeNetworkOfDummiesReachableFromEnd) { ...@@ -108,18 +106,18 @@ TEST(NodeNetworkOfDummiesReachableFromEnd) {
Node* start = graph.NewNode(common.Start(0)); Node* start = graph.NewNode(common.Start(0));
graph.SetStart(start); graph.SetStart(start);
Node* n2 = graph.NewNode(&dummy_operator1, graph.start()); Node* n2 = graph.NewNode(&dummy_operator, graph.start());
Node* n3 = graph.NewNode(&dummy_operator1, graph.start()); Node* n3 = graph.NewNode(&dummy_operator, graph.start());
Node* n4 = graph.NewNode(&dummy_operator1, n2); Node* n4 = graph.NewNode(&dummy_operator, n2);
Node* n5 = graph.NewNode(&dummy_operator1, n2); Node* n5 = graph.NewNode(&dummy_operator, n2);
Node* n6 = graph.NewNode(&dummy_operator1, n3); Node* n6 = graph.NewNode(&dummy_operator, n3);
Node* n7 = graph.NewNode(&dummy_operator1, n3); Node* n7 = graph.NewNode(&dummy_operator, n3);
Node* n8 = graph.NewNode(&dummy_operator1, n5); Node* n8 = graph.NewNode(&dummy_operator, n5);
Node* n9 = graph.NewNode(&dummy_operator1, n5); Node* n9 = graph.NewNode(&dummy_operator, n5);
Node* n10 = graph.NewNode(&dummy_operator1, n9); Node* n10 = graph.NewNode(&dummy_operator, n9);
Node* n11 = graph.NewNode(&dummy_operator1, n9); Node* n11 = graph.NewNode(&dummy_operator, n9);
Node* end_dependencies[6] = {n4, n8, n10, n11, n6, n7}; Node* end_dependencies[6] = {n4, n8, n10, n11, n6, n7};
Node* end = graph.NewNode(&dummy_operator6, 6, end_dependencies); Node* end = graph.NewNode(&dummy_operator, 6, end_dependencies);
graph.SetEnd(end); graph.SetEnd(end);
OFStream os(stdout); OFStream os(stdout);
......
...@@ -41,8 +41,7 @@ class JSConstantCacheTester : public HandleAndZoneScope, ...@@ -41,8 +41,7 @@ class JSConstantCacheTester : public HandleAndZoneScope,
JSGraph(main_isolate(), &main_graph_, &main_common_, &main_javascript_, JSGraph(main_isolate(), &main_graph_, &main_common_, &main_javascript_,
&main_machine_) { &main_machine_) {
main_graph_.SetStart(main_graph_.NewNode(common()->Start(0))); main_graph_.SetStart(main_graph_.NewNode(common()->Start(0)));
main_graph_.SetEnd( main_graph_.SetEnd(main_graph_.NewNode(common()->End(1)));
main_graph_.NewNode(common()->End(1), main_graph_.start()));
main_typer_.Run(); main_typer_.Run();
} }
......
...@@ -140,27 +140,24 @@ TEST(ReduceJSStoreContext) { ...@@ -140,27 +140,24 @@ TEST(ReduceJSStoreContext) {
{ {
// Mutable slot, constant context, depth = 0 => do nothing. // Mutable slot, constant context, depth = 0 => do nothing.
Node* load = Node* load = t.graph()->NewNode(t.javascript()->StoreContext(0, 0),
t.graph()->NewNode(t.javascript()->StoreContext(0, 0), const_context, const_context, const_context, start);
const_context, const_context, start, start);
Reduction r = t.spec()->Reduce(load); Reduction r = t.spec()->Reduce(load);
CHECK(!r.Changed()); CHECK(!r.Changed());
} }
{ {
// Mutable slot, non-constant context, depth = 0 => do nothing. // Mutable slot, non-constant context, depth = 0 => do nothing.
Node* load = Node* load = t.graph()->NewNode(t.javascript()->StoreContext(0, 0),
t.graph()->NewNode(t.javascript()->StoreContext(0, 0), param_context, param_context, param_context, start);
param_context, const_context, start, start);
Reduction r = t.spec()->Reduce(load); Reduction r = t.spec()->Reduce(load);
CHECK(!r.Changed()); CHECK(!r.Changed());
} }
{ {
// Immutable slot, constant context, depth = 0 => do nothing. // Immutable slot, constant context, depth = 0 => do nothing.
Node* load = Node* load = t.graph()->NewNode(t.javascript()->StoreContext(0, slot),
t.graph()->NewNode(t.javascript()->StoreContext(0, slot), const_context, const_context, const_context, start);
const_context, const_context, start, start);
Reduction r = t.spec()->Reduce(load); Reduction r = t.spec()->Reduce(load);
CHECK(!r.Changed()); CHECK(!r.Changed());
} }
...@@ -169,7 +166,7 @@ TEST(ReduceJSStoreContext) { ...@@ -169,7 +166,7 @@ TEST(ReduceJSStoreContext) {
// Mutable slot, constant context, depth > 0 => fold-in parent context. // Mutable slot, constant context, depth > 0 => fold-in parent context.
Node* load = t.graph()->NewNode( Node* load = t.graph()->NewNode(
t.javascript()->StoreContext(2, Context::GLOBAL_EVAL_FUN_INDEX), t.javascript()->StoreContext(2, Context::GLOBAL_EVAL_FUN_INDEX),
deep_const_context, deep_const_context, const_context, start, start); deep_const_context, deep_const_context, start);
Reduction r = t.spec()->Reduce(load); Reduction r = t.spec()->Reduce(load);
CHECK(r.Changed()); CHECK(r.Changed());
Node* new_context_input = NodeProperties::GetValueInput(r.replacement(), 0); Node* new_context_input = NodeProperties::GetValueInput(r.replacement(), 0);
...@@ -222,10 +219,9 @@ TEST(SpecializeToContext) { ...@@ -222,10 +219,9 @@ TEST(SpecializeToContext) {
Node* other_use = Node* other_use =
t.graph()->NewNode(t.simplified()->ChangeTaggedToInt32(), other_load); t.graph()->NewNode(t.simplified()->ChangeTaggedToInt32(), other_load);
Node* add = t.graph()->NewNode( Node* add =
t.javascript()->Add(LanguageMode::SLOPPY), value_use, other_use, t.graph()->NewNode(t.javascript()->Add(LanguageMode::SLOPPY), value_use,
param_context, t.jsgraph()->EmptyFrameState(), other_use, param_context, other_load, start);
t.jsgraph()->EmptyFrameState(), other_load, start);
Node* ret = Node* ret =
t.graph()->NewNode(t.common()->Return(), add, effect_use, start); t.graph()->NewNode(t.common()->Return(), add, effect_use, start);
......
...@@ -41,7 +41,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope { ...@@ -41,7 +41,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
typer(main_isolate(), &graph), typer(main_isolate(), &graph),
context_node(NULL) { context_node(NULL) {
graph.SetStart(graph.NewNode(common.Start(num_parameters))); graph.SetStart(graph.NewNode(common.Start(num_parameters)));
graph.SetEnd(graph.NewNode(common.End(1), graph.start())); graph.SetEnd(graph.NewNode(common.End(1)));
typer.Run(); typer.Run();
} }
...@@ -79,7 +79,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope { ...@@ -79,7 +79,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
Node* state_node = graph.NewNode( Node* state_node = graph.NewNode(
common.FrameState(BailoutId::None(), OutputFrameStateCombine::Ignore(), common.FrameState(BailoutId::None(), OutputFrameStateCombine::Ignore(),
nullptr), nullptr),
parameters, locals, stack, context, UndefinedConstant(), graph.start()); parameters, locals, stack, context, UndefinedConstant());
return state_node; return state_node;
} }
...@@ -125,23 +125,16 @@ class JSTypedLoweringTester : public HandleAndZoneScope { ...@@ -125,23 +125,16 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
Node* Binop(const Operator* op, Node* left, Node* right) { Node* Binop(const Operator* op, Node* left, Node* right) {
// JS binops also require context, effect, and control // JS binops also require context, effect, and control
std::vector<Node*> inputs; if (OperatorProperties::GetFrameStateInputCount(op) == 1) {
inputs.push_back(left); return graph.NewNode(op, left, right, context(),
inputs.push_back(right); EmptyFrameState(context()), start(), control());
if (OperatorProperties::HasContextInput(op)) { } else if (OperatorProperties::GetFrameStateInputCount(op) == 2) {
inputs.push_back(context()); return graph.NewNode(op, left, right, context(),
} EmptyFrameState(context()),
for (int i = 0; i < OperatorProperties::GetFrameStateInputCount(op); i++) { EmptyFrameState(context()), start(), control());
inputs.push_back(EmptyFrameState(context())); } else {
} return graph.NewNode(op, left, right, context(), start(), control());
if (op->EffectInputCount() > 0) {
inputs.push_back(start());
}
if (op->ControlInputCount() > 0) {
inputs.push_back(control());
} }
return graph.NewNode(op, static_cast<int>(inputs.size()),
&(inputs.front()));
} }
Node* Unop(const Operator* op, Node* input) { Node* Unop(const Operator* op, Node* input) {
...@@ -835,18 +828,15 @@ void CheckEqualityReduction(JSTypedLoweringTester* R, bool strict, Node* l, ...@@ -835,18 +828,15 @@ void CheckEqualityReduction(JSTypedLoweringTester* R, bool strict, Node* l,
Node* p1 = j == 1 ? l : r; Node* p1 = j == 1 ? l : r;
{ {
Node* eq = strict Node* eq = strict ? R->graph.NewNode(R->javascript.StrictEqual(), p0, p1)
? R->graph.NewNode(R->javascript.StrictEqual(), p0, p1, : R->Binop(R->javascript.Equal(), p0, p1);
R->context())
: R->Binop(R->javascript.Equal(), p0, p1);
Node* r = R->reduce(eq); Node* r = R->reduce(eq);
R->CheckPureBinop(expected, r); R->CheckPureBinop(expected, r);
} }
{ {
Node* ne = strict Node* ne = strict
? R->graph.NewNode(R->javascript.StrictNotEqual(), p0, p1, ? R->graph.NewNode(R->javascript.StrictNotEqual(), p0, p1)
R->context())
: R->Binop(R->javascript.NotEqual(), p0, p1); : R->Binop(R->javascript.NotEqual(), p0, p1);
Node* n = R->reduce(ne); Node* n = R->reduce(ne);
CHECK_EQ(IrOpcode::kBooleanNot, n->opcode()); CHECK_EQ(IrOpcode::kBooleanNot, n->opcode());
......
...@@ -703,8 +703,7 @@ TEST(ReduceLoadStore) { ...@@ -703,8 +703,7 @@ TEST(ReduceLoadStore) {
Node* base = R.Constant<int32_t>(11); Node* base = R.Constant<int32_t>(11);
Node* index = R.Constant<int32_t>(4); Node* index = R.Constant<int32_t>(4);
Node* load = R.graph.NewNode(R.machine.Load(kMachInt32), base, index, Node* load = R.graph.NewNode(R.machine.Load(kMachInt32), base, index);
R.graph.start(), R.graph.start());
{ {
MachineOperatorReducer reducer(&R.jsgraph); MachineOperatorReducer reducer(&R.jsgraph);
...@@ -715,7 +714,7 @@ TEST(ReduceLoadStore) { ...@@ -715,7 +714,7 @@ TEST(ReduceLoadStore) {
{ {
Node* store = R.graph.NewNode( Node* store = R.graph.NewNode(
R.machine.Store(StoreRepresentation(kMachInt32, kNoWriteBarrier)), base, R.machine.Store(StoreRepresentation(kMachInt32, kNoWriteBarrier)), base,
index, load, load, load); index, load);
MachineOperatorReducer reducer(&R.jsgraph); MachineOperatorReducer reducer(&R.jsgraph);
Reduction reduction = reducer.Reduce(store); Reduction reduction = reducer.Reduce(store);
CHECK(!reduction.Changed()); // stores should not be reduced. CHECK(!reduction.Changed()); // stores should not be reduced.
......
This diff is collapsed.
...@@ -72,7 +72,7 @@ TEST(CodeGenInt32Binop) { ...@@ -72,7 +72,7 @@ TEST(CodeGenInt32Binop) {
RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32); RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
Node* a = Int32Input(&m, j); Node* a = Int32Input(&m, j);
Node* b = Int32Input(&m, k); Node* b = Int32Input(&m, k);
m.Return(m.AddNode(kOps[i], a, b)); m.Return(m.NewNode(kOps[i], a, b));
m.GenerateCode(); m.GenerateCode();
} }
} }
...@@ -132,7 +132,7 @@ TEST(CodeGenInt64Binop) { ...@@ -132,7 +132,7 @@ TEST(CodeGenInt64Binop) {
RawMachineAssemblerTester<int64_t> m(kMachInt64, kMachInt64); RawMachineAssemblerTester<int64_t> m(kMachInt64, kMachInt64);
Node* a = Int64Input(&m, j); Node* a = Int64Input(&m, j);
Node* b = Int64Input(&m, k); Node* b = Int64Input(&m, k);
m.Return(m.AddNode(kOps[i], a, b)); m.Return(m.NewNode(kOps[i], a, b));
m.GenerateCode(); m.GenerateCode();
} }
} }
...@@ -626,7 +626,7 @@ TEST(RunSwitch4) { ...@@ -626,7 +626,7 @@ TEST(RunSwitch4) {
m.Bind(&end); m.Bind(&end);
const int num_results = static_cast<int>(arraysize(results)); const int num_results = static_cast<int>(arraysize(results));
Node* phi = Node* phi =
m.AddNode(m.common()->Phi(kMachInt32, num_results), num_results, results); m.NewNode(m.common()->Phi(kMachInt32, num_results), num_results, results);
m.Return(phi); m.Return(phi);
for (size_t i = 0; i < kNumValues; ++i) { for (size_t i = 0; i < kNumValues; ++i) {
...@@ -1053,7 +1053,7 @@ TEST(RunInt32AddInBranch) { ...@@ -1053,7 +1053,7 @@ TEST(RunInt32AddInBranch) {
kMachUint32); kMachUint32);
MLabel blocka, blockb; MLabel blocka, blockb;
m.Branch(m.Word32Equal(m.Int32Add(m.Parameter(0), m.Branch(m.Word32Equal(m.Int32Add(m.Parameter(0),
m.AddNode(shops[n], m.Parameter(1), m.NewNode(shops[n], m.Parameter(1),
m.Parameter(2))), m.Parameter(2))),
m.Int32Constant(0)), m.Int32Constant(0)),
&blocka, &blockb); &blocka, &blockb);
...@@ -1145,7 +1145,7 @@ TEST(RunInt32AddInComparison) { ...@@ -1145,7 +1145,7 @@ TEST(RunInt32AddInComparison) {
kMachUint32); kMachUint32);
m.Return(m.Word32Equal( m.Return(m.Word32Equal(
m.Int32Add(m.Parameter(0), m.Int32Add(m.Parameter(0),
m.AddNode(shops[n], m.Parameter(1), m.Parameter(2))), m.NewNode(shops[n], m.Parameter(1), m.Parameter(2))),
m.Int32Constant(0))); m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) { FOR_UINT32_INPUTS(i) {
FOR_INT32_INPUTS(j) { FOR_INT32_INPUTS(j) {
...@@ -1390,7 +1390,7 @@ TEST(RunInt32SubInBranch) { ...@@ -1390,7 +1390,7 @@ TEST(RunInt32SubInBranch) {
kMachUint32); kMachUint32);
MLabel blocka, blockb; MLabel blocka, blockb;
m.Branch(m.Word32Equal(m.Int32Sub(m.Parameter(0), m.Branch(m.Word32Equal(m.Int32Sub(m.Parameter(0),
m.AddNode(shops[n], m.Parameter(1), m.NewNode(shops[n], m.Parameter(1),
m.Parameter(2))), m.Parameter(2))),
m.Int32Constant(0)), m.Int32Constant(0)),
&blocka, &blockb); &blocka, &blockb);
...@@ -1482,7 +1482,7 @@ TEST(RunInt32SubInComparison) { ...@@ -1482,7 +1482,7 @@ TEST(RunInt32SubInComparison) {
kMachUint32); kMachUint32);
m.Return(m.Word32Equal( m.Return(m.Word32Equal(
m.Int32Sub(m.Parameter(0), m.Int32Sub(m.Parameter(0),
m.AddNode(shops[n], m.Parameter(1), m.Parameter(2))), m.NewNode(shops[n], m.Parameter(1), m.Parameter(2))),
m.Int32Constant(0))); m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) { FOR_UINT32_INPUTS(i) {
FOR_INT32_INPUTS(j) { FOR_INT32_INPUTS(j) {
...@@ -2059,7 +2059,7 @@ TEST(RunWord32AndInBranch) { ...@@ -2059,7 +2059,7 @@ TEST(RunWord32AndInBranch) {
kMachUint32); kMachUint32);
MLabel blocka, blockb; MLabel blocka, blockb;
m.Branch(m.Word32Equal(m.Word32And(m.Parameter(0), m.Branch(m.Word32Equal(m.Word32And(m.Parameter(0),
m.AddNode(shops[n], m.Parameter(1), m.NewNode(shops[n], m.Parameter(1),
m.Parameter(2))), m.Parameter(2))),
m.Int32Constant(0)), m.Int32Constant(0)),
&blocka, &blockb); &blocka, &blockb);
...@@ -2287,7 +2287,7 @@ TEST(RunWord32OrInBranch) { ...@@ -2287,7 +2287,7 @@ TEST(RunWord32OrInBranch) {
kMachUint32); kMachUint32);
MLabel blocka, blockb; MLabel blocka, blockb;
m.Branch(m.Word32Equal(m.Word32Or(m.Parameter(0), m.Branch(m.Word32Equal(m.Word32Or(m.Parameter(0),
m.AddNode(shops[n], m.Parameter(1), m.NewNode(shops[n], m.Parameter(1),
m.Parameter(2))), m.Parameter(2))),
m.Int32Constant(0)), m.Int32Constant(0)),
&blocka, &blockb); &blocka, &blockb);
...@@ -2512,7 +2512,7 @@ TEST(RunWord32XorInBranch) { ...@@ -2512,7 +2512,7 @@ TEST(RunWord32XorInBranch) {
kMachUint32); kMachUint32);
MLabel blocka, blockb; MLabel blocka, blockb;
m.Branch(m.Word32Equal(m.Word32Xor(m.Parameter(0), m.Branch(m.Word32Equal(m.Word32Xor(m.Parameter(0),
m.AddNode(shops[n], m.Parameter(1), m.NewNode(shops[n], m.Parameter(1),
m.Parameter(2))), m.Parameter(2))),
m.Int32Constant(0)), m.Int32Constant(0)),
&blocka, &blockb); &blocka, &blockb);
...@@ -3022,7 +3022,7 @@ TEST(RunDeadInt32Binops) { ...@@ -3022,7 +3022,7 @@ TEST(RunDeadInt32Binops) {
for (size_t i = 0; i < arraysize(kOps); ++i) { for (size_t i = 0; i < arraysize(kOps); ++i) {
RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32); RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
int32_t constant = static_cast<int32_t>(0x55555 + i); int32_t constant = static_cast<int32_t>(0x55555 + i);
m.AddNode(kOps[i], m.Parameter(0), m.Parameter(1)); m.NewNode(kOps[i], m.Parameter(0), m.Parameter(1));
m.Return(m.Int32Constant(constant)); m.Return(m.Int32Constant(constant));
CHECK_EQ(constant, m.Call(1, 1)); CHECK_EQ(constant, m.Call(1, 1));
...@@ -3137,9 +3137,9 @@ TEST(RunFloat32Binop) { ...@@ -3137,9 +3137,9 @@ TEST(RunFloat32Binop) {
for (int i = 0; ops[i] != NULL; i++) { for (int i = 0; ops[i] != NULL; i++) {
for (int j = 0; inputs[j] != NULL; j += 2) { for (int j = 0; inputs[j] != NULL; j += 2) {
RawMachineAssemblerTester<int32_t> m; RawMachineAssemblerTester<int32_t> m;
Node* a = m.AddNode(inputs[j]); Node* a = m.NewNode(inputs[j]);
Node* b = m.AddNode(inputs[j + 1]); Node* b = m.NewNode(inputs[j + 1]);
Node* binop = m.AddNode(ops[i], a, b); Node* binop = m.NewNode(ops[i], a, b);
Node* base = m.PointerConstant(&result); Node* base = m.PointerConstant(&result);
Node* zero = m.IntPtrConstant(0); Node* zero = m.IntPtrConstant(0);
m.Store(kMachFloat32, base, zero, binop); m.Store(kMachFloat32, base, zero, binop);
...@@ -3173,9 +3173,9 @@ TEST(RunFloat64Binop) { ...@@ -3173,9 +3173,9 @@ TEST(RunFloat64Binop) {
for (int i = 0; ops[i] != NULL; i++) { for (int i = 0; ops[i] != NULL; i++) {
for (int j = 0; inputs[j] != NULL; j += 2) { for (int j = 0; inputs[j] != NULL; j += 2) {
RawMachineAssemblerTester<int32_t> m; RawMachineAssemblerTester<int32_t> m;
Node* a = m.AddNode(inputs[j]); Node* a = m.NewNode(inputs[j]);
Node* b = m.AddNode(inputs[j + 1]); Node* b = m.NewNode(inputs[j + 1]);
Node* binop = m.AddNode(ops[i], a, b); Node* binop = m.NewNode(ops[i], a, b);
Node* base = m.PointerConstant(&result); Node* base = m.PointerConstant(&result);
Node* zero = m.Int32Constant(0); Node* zero = m.Int32Constant(0);
m.Store(kMachFloat64, base, zero, binop); m.Store(kMachFloat64, base, zero, binop);
...@@ -3196,7 +3196,7 @@ TEST(RunDeadFloat32Binops) { ...@@ -3196,7 +3196,7 @@ TEST(RunDeadFloat32Binops) {
for (int i = 0; ops[i] != NULL; i++) { for (int i = 0; ops[i] != NULL; i++) {
RawMachineAssemblerTester<int32_t> m; RawMachineAssemblerTester<int32_t> m;
int constant = 0x53355 + i; int constant = 0x53355 + i;
m.AddNode(ops[i], m.Float32Constant(0.1f), m.Float32Constant(1.11f)); m.NewNode(ops[i], m.Float32Constant(0.1f), m.Float32Constant(1.11f));
m.Return(m.Int32Constant(constant)); m.Return(m.Int32Constant(constant));
CHECK_EQ(constant, m.Call()); CHECK_EQ(constant, m.Call());
} }
...@@ -3213,7 +3213,7 @@ TEST(RunDeadFloat64Binops) { ...@@ -3213,7 +3213,7 @@ TEST(RunDeadFloat64Binops) {
for (int i = 0; ops[i] != NULL; i++) { for (int i = 0; ops[i] != NULL; i++) {
RawMachineAssemblerTester<int32_t> m; RawMachineAssemblerTester<int32_t> m;
int constant = 0x53355 + i; int constant = 0x53355 + i;
m.AddNode(ops[i], m.Float64Constant(0.1), m.Float64Constant(1.11)); m.NewNode(ops[i], m.Float64Constant(0.1), m.Float64Constant(1.11));
m.Return(m.Int32Constant(constant)); m.Return(m.Int32Constant(constant));
CHECK_EQ(constant, m.Call()); CHECK_EQ(constant, m.Call());
} }
...@@ -4289,7 +4289,7 @@ TEST(RunFloat64UnorderedCompare) { ...@@ -4289,7 +4289,7 @@ TEST(RunFloat64UnorderedCompare) {
Node* a = m.Float64Constant(*i); Node* a = m.Float64Constant(*i);
Node* b = m.Float64Constant(nan); Node* b = m.Float64Constant(nan);
if (j == 1) std::swap(a, b); if (j == 1) std::swap(a, b);
m.Return(m.AddNode(operators[o], a, b)); m.Return(m.NewNode(operators[o], a, b));
CHECK_EQ(0, m.Call()); CHECK_EQ(0, m.Call());
} }
} }
...@@ -5287,7 +5287,7 @@ TEST(RunCheckedLoadInt64) { ...@@ -5287,7 +5287,7 @@ TEST(RunCheckedLoadInt64) {
Node* index = m.Parameter(0); Node* index = m.Parameter(0);
Node* length = m.Int32Constant(16); Node* length = m.Int32Constant(16);
Node* load = Node* load =
m.AddNode(m.machine()->CheckedLoad(kMachInt64), base, index, length); m.NewNode(m.machine()->CheckedLoad(kMachInt64), base, index, length);
m.Return(load); m.Return(load);
CHECK_EQ(buffer[0], m.Call(0)); CHECK_EQ(buffer[0], m.Call(0));
...@@ -5305,7 +5305,7 @@ TEST(RunCheckedStoreInt64) { ...@@ -5305,7 +5305,7 @@ TEST(RunCheckedStoreInt64) {
Node* index = m.Parameter(0); Node* index = m.Parameter(0);
Node* length = m.Int32Constant(16); Node* length = m.Int32Constant(16);
Node* value = m.Int64Constant(write); Node* value = m.Int64Constant(write);
Node* store = m.AddNode(m.machine()->CheckedStore(kMachInt64), base, index, Node* store = m.NewNode(m.machine()->CheckedStore(kMachInt64), base, index,
length, value); length, value);
USE(store); USE(store);
m.Return(m.Int32Constant(11)); m.Return(m.Int32Constant(11));
......
...@@ -1219,10 +1219,7 @@ TEST(InsertBasicChanges) { ...@@ -1219,10 +1219,7 @@ TEST(InsertBasicChanges) {
static void CheckChangesAroundBinop(TestingGraph* t, const Operator* op, static void CheckChangesAroundBinop(TestingGraph* t, const Operator* op,
IrOpcode::Value input_change, IrOpcode::Value input_change,
IrOpcode::Value output_change) { IrOpcode::Value output_change) {
Node* binop = Node* binop = t->graph()->NewNode(op, t->p0, t->p1);
op->ControlInputCount() == 0
? t->graph()->NewNode(op, t->p0, t->p1)
: t->graph()->NewNode(op, t->p0, t->p1, t->graph()->start());
t->Return(binop); t->Return(binop);
t->Lower(); t->Lower();
CHECK_EQ(input_change, binop->InputAt(0)->opcode()); CHECK_EQ(input_change, binop->InputAt(0)->opcode());
......
...@@ -290,8 +290,7 @@ const IfExceptionHint kNoHint = IfExceptionHint::kLocallyCaught; ...@@ -290,8 +290,7 @@ const IfExceptionHint kNoHint = IfExceptionHint::kLocallyCaught;
TEST_F(AdvancedReducerTest, ReplaceWithValue_ValueUse) { TEST_F(AdvancedReducerTest, ReplaceWithValue_ValueUse) {
CommonOperatorBuilder common(zone()); CommonOperatorBuilder common(zone());
Node* node = graph()->NewNode(&kMockOperator); Node* node = graph()->NewNode(&kMockOperator);
Node* start = graph()->NewNode(common.Start(1)); Node* use_value = graph()->NewNode(common.Return(), node);
Node* use_value = graph()->NewNode(common.Return(), node, start, start);
Node* replacement = graph()->NewNode(&kMockOperator); Node* replacement = graph()->NewNode(&kMockOperator);
GraphReducer graph_reducer(zone(), graph(), nullptr); GraphReducer graph_reducer(zone(), graph(), nullptr);
ReplaceWithValueReducer r(&graph_reducer); ReplaceWithValueReducer r(&graph_reducer);
...@@ -307,18 +306,16 @@ TEST_F(AdvancedReducerTest, ReplaceWithValue_EffectUse) { ...@@ -307,18 +306,16 @@ TEST_F(AdvancedReducerTest, ReplaceWithValue_EffectUse) {
CommonOperatorBuilder common(zone()); CommonOperatorBuilder common(zone());
Node* start = graph()->NewNode(common.Start(1)); Node* start = graph()->NewNode(common.Start(1));
Node* node = graph()->NewNode(&kMockOpEffect, start); Node* node = graph()->NewNode(&kMockOpEffect, start);
Node* use_control = graph()->NewNode(common.Merge(1), start); Node* use_effect = graph()->NewNode(common.EffectPhi(1), node);
Node* use_effect = graph()->NewNode(common.EffectPhi(1), node, use_control);
Node* replacement = graph()->NewNode(&kMockOperator); Node* replacement = graph()->NewNode(&kMockOperator);
GraphReducer graph_reducer(zone(), graph(), nullptr); GraphReducer graph_reducer(zone(), graph(), nullptr);
ReplaceWithValueReducer r(&graph_reducer); ReplaceWithValueReducer r(&graph_reducer);
r.ReplaceWithValue(node, replacement); r.ReplaceWithValue(node, replacement);
EXPECT_EQ(start, use_effect->InputAt(0)); EXPECT_EQ(start, use_effect->InputAt(0));
EXPECT_EQ(0, node->UseCount()); EXPECT_EQ(0, node->UseCount());
EXPECT_EQ(3, start->UseCount()); EXPECT_EQ(2, start->UseCount());
EXPECT_EQ(0, replacement->UseCount()); EXPECT_EQ(0, replacement->UseCount());
EXPECT_THAT(start->uses(), EXPECT_THAT(start->uses(), UnorderedElementsAre(use_effect, node));
UnorderedElementsAre(use_effect, use_control, node));
} }
......
...@@ -248,7 +248,7 @@ TARGET_TEST_F(InstructionSelectorTest, ReferenceParameter) { ...@@ -248,7 +248,7 @@ TARGET_TEST_F(InstructionSelectorTest, ReferenceParameter) {
TARGET_TEST_F(InstructionSelectorTest, Finish) { TARGET_TEST_F(InstructionSelectorTest, Finish) {
StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged); StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged);
Node* param = m.Parameter(0); Node* param = m.Parameter(0);
Node* finish = m.AddNode(m.common()->Finish(1), param, m.graph()->start()); Node* finish = m.NewNode(m.common()->Finish(1), param, m.graph()->start());
m.Return(finish); m.Return(finish);
Stream s = m.Build(kAllInstructions); Stream s = m.Build(kAllInstructions);
ASSERT_EQ(4U, s.size()); ASSERT_EQ(4U, s.size());
...@@ -334,8 +334,8 @@ TARGET_TEST_F(InstructionSelectorTest, ValueEffect) { ...@@ -334,8 +334,8 @@ TARGET_TEST_F(InstructionSelectorTest, ValueEffect) {
Stream s1 = m1.Build(kAllInstructions); Stream s1 = m1.Build(kAllInstructions);
StreamBuilder m2(this, kMachInt32, kMachPtr); StreamBuilder m2(this, kMachInt32, kMachPtr);
Node* p2 = m2.Parameter(0); Node* p2 = m2.Parameter(0);
m2.Return(m2.AddNode(m2.machine()->Load(kMachInt32), p2, m2.Int32Constant(0), m2.Return(m2.NewNode(m2.machine()->Load(kMachInt32), p2, m2.Int32Constant(0),
m2.AddNode(m2.common()->ValueEffect(1), p2))); m2.NewNode(m2.common()->ValueEffect(1), p2)));
Stream s2 = m2.Build(kAllInstructions); Stream s2 = m2.Build(kAllInstructions);
EXPECT_LE(3U, s1.size()); EXPECT_LE(3U, s1.size());
ASSERT_EQ(s1.size(), s2.size()); ASSERT_EQ(s1.size(), s2.size());
...@@ -370,12 +370,12 @@ TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) { ...@@ -370,12 +370,12 @@ TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) {
zone(), false, 1, CallDescriptor::kNeedsFrameState); zone(), false, 1, CallDescriptor::kNeedsFrameState);
Node* parameters = Node* parameters =
m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(1)); m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(1));
Node* locals = m.AddNode(m.common()->TypedStateValues(&empty_types)); Node* locals = m.NewNode(m.common()->TypedStateValues(&empty_types));
Node* stack = m.AddNode(m.common()->TypedStateValues(&empty_types)); Node* stack = m.NewNode(m.common()->TypedStateValues(&empty_types));
Node* context_dummy = m.Int32Constant(0); Node* context_dummy = m.Int32Constant(0);
Node* state_node = m.AddNode( Node* state_node = m.NewNode(
m.common()->FrameState(bailout_id, OutputFrameStateCombine::Push(), m.common()->FrameState(bailout_id, OutputFrameStateCombine::Push(),
m.GetFrameStateFunctionInfo(1, 0)), m.GetFrameStateFunctionInfo(1, 0)),
parameters, locals, stack, context_dummy, function_node, parameters, locals, stack, context_dummy, function_node,
...@@ -419,14 +419,14 @@ TARGET_TEST_F(InstructionSelectorTest, CallFunctionStubWithDeopt) { ...@@ -419,14 +419,14 @@ TARGET_TEST_F(InstructionSelectorTest, CallFunctionStubWithDeopt) {
// Build frame state for the state before the call. // Build frame state for the state before the call.
Node* parameters = Node* parameters =
m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(43)); m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(43));
Node* locals = m.AddNode(m.common()->TypedStateValues(&float64_type), Node* locals = m.NewNode(m.common()->TypedStateValues(&float64_type),
m.Float64Constant(0.5)); m.Float64Constant(0.5));
Node* stack = m.AddNode(m.common()->TypedStateValues(&tagged_type), Node* stack = m.NewNode(m.common()->TypedStateValues(&tagged_type),
m.UndefinedConstant()); m.UndefinedConstant());
Node* context_sentinel = m.Int32Constant(0); Node* context_sentinel = m.Int32Constant(0);
Node* frame_state_before = m.AddNode( Node* frame_state_before = m.NewNode(
m.common()->FrameState(bailout_id_before, OutputFrameStateCombine::Push(), m.common()->FrameState(bailout_id_before, OutputFrameStateCombine::Push(),
m.GetFrameStateFunctionInfo(1, 1)), m.GetFrameStateFunctionInfo(1, 1)),
parameters, locals, stack, context_sentinel, function_node, parameters, locals, stack, context_sentinel, function_node,
...@@ -515,12 +515,12 @@ TARGET_TEST_F(InstructionSelectorTest, ...@@ -515,12 +515,12 @@ TARGET_TEST_F(InstructionSelectorTest,
// Build frame state for the state before the call. // Build frame state for the state before the call.
Node* parameters = Node* parameters =
m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(63)); m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(63));
Node* locals = Node* locals =
m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(64)); m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(64));
Node* stack = Node* stack =
m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(65)); m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(65));
Node* frame_state_parent = m.AddNode( Node* frame_state_parent = m.NewNode(
m.common()->FrameState(bailout_id_parent, m.common()->FrameState(bailout_id_parent,
OutputFrameStateCombine::Ignore(), OutputFrameStateCombine::Ignore(),
m.GetFrameStateFunctionInfo(1, 1)), m.GetFrameStateFunctionInfo(1, 1)),
...@@ -528,12 +528,12 @@ TARGET_TEST_F(InstructionSelectorTest, ...@@ -528,12 +528,12 @@ TARGET_TEST_F(InstructionSelectorTest,
Node* context2 = m.Int32Constant(46); Node* context2 = m.Int32Constant(46);
Node* parameters2 = Node* parameters2 =
m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(43)); m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(43));
Node* locals2 = m.AddNode(m.common()->TypedStateValues(&float64_type), Node* locals2 = m.NewNode(m.common()->TypedStateValues(&float64_type),
m.Float64Constant(0.25)); m.Float64Constant(0.25));
Node* stack2 = m.AddNode(m.common()->TypedStateValues(&int32x2_type), Node* stack2 = m.NewNode(m.common()->TypedStateValues(&int32x2_type),
m.Int32Constant(44), m.Int32Constant(45)); m.Int32Constant(44), m.Int32Constant(45));
Node* frame_state_before = m.AddNode( Node* frame_state_before = m.NewNode(
m.common()->FrameState(bailout_id_before, OutputFrameStateCombine::Push(), m.common()->FrameState(bailout_id_before, OutputFrameStateCombine::Push(),
m.GetFrameStateFunctionInfo(1, 1)), m.GetFrameStateFunctionInfo(1, 1)),
parameters2, locals2, stack2, context2, function_node, parameters2, locals2, stack2, context2, function_node,
......
...@@ -153,10 +153,13 @@ TEST_F(JSContextRelaxationTest, ...@@ -153,10 +153,13 @@ TEST_F(JSContextRelaxationTest,
Node* const context = Parameter(2); Node* const context = Parameter(2);
Node* const outer_context = Parameter(3); Node* const outer_context = Parameter(3);
const Operator* op = javascript()->CreateCatchContext(Handle<String>()); const Operator* op = javascript()->CreateCatchContext(Handle<String>());
Node* const frame_state_1 =
ShallowFrameStateChain(outer_context, CALL_MAINTAINS_NATIVE_CONTEXT);
Node* const effect = graph()->start(); Node* const effect = graph()->start();
Node* const control = graph()->start(); Node* const control = graph()->start();
Node* nested_context = graph()->NewNode( Node* nested_context =
op, graph()->start(), graph()->start(), outer_context, effect, control); graph()->NewNode(op, graph()->start(), graph()->start(), outer_context,
frame_state_1, effect, control);
Node* const frame_state_2 = Node* const frame_state_2 =
ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT); ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT);
Node* node = Node* node =
...@@ -202,10 +205,13 @@ TEST_F(JSContextRelaxationTest, ...@@ -202,10 +205,13 @@ TEST_F(JSContextRelaxationTest,
Node* const context = Parameter(2); Node* const context = Parameter(2);
Node* const outer_context = Parameter(3); Node* const outer_context = Parameter(3);
const Operator* op = javascript()->CreateBlockContext(); const Operator* op = javascript()->CreateBlockContext();
Node* const frame_state_1 =
ShallowFrameStateChain(outer_context, CALL_MAINTAINS_NATIVE_CONTEXT);
Node* const effect = graph()->start(); Node* const effect = graph()->start();
Node* const control = graph()->start(); Node* const control = graph()->start();
Node* nested_context = graph()->NewNode( Node* nested_context =
op, graph()->start(), graph()->start(), outer_context, effect, control); graph()->NewNode(op, graph()->start(), graph()->start(), outer_context,
frame_state_1, effect, control);
Node* const frame_state_2 = Node* const frame_state_2 =
ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT); ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT);
Node* node = Node* node =
...@@ -251,10 +257,13 @@ TEST_F(JSContextRelaxationTest, ...@@ -251,10 +257,13 @@ TEST_F(JSContextRelaxationTest,
Node* const context = Parameter(2); Node* const context = Parameter(2);
Node* const outer_context = Parameter(3); Node* const outer_context = Parameter(3);
const Operator* op = javascript()->CreateModuleContext(); const Operator* op = javascript()->CreateModuleContext();
Node* const frame_state_1 =
ShallowFrameStateChain(outer_context, CALL_MAINTAINS_NATIVE_CONTEXT);
Node* const effect = graph()->start(); Node* const effect = graph()->start();
Node* const control = graph()->start(); Node* const control = graph()->start();
Node* nested_context = graph()->NewNode( Node* nested_context =
op, graph()->start(), graph()->start(), outer_context, effect, control); graph()->NewNode(op, graph()->start(), graph()->start(), outer_context,
frame_state_1, effect, control);
Node* const frame_state_2 = Node* const frame_state_2 =
ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT); ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT);
Node* node = Node* node =
...@@ -274,10 +283,13 @@ TEST_F(JSContextRelaxationTest, ...@@ -274,10 +283,13 @@ TEST_F(JSContextRelaxationTest,
Node* const context = Parameter(2); Node* const context = Parameter(2);
Node* const outer_context = Parameter(3); Node* const outer_context = Parameter(3);
const Operator* op = javascript()->CreateFunctionContext(); const Operator* op = javascript()->CreateFunctionContext();
Node* const frame_state_1 =
ShallowFrameStateChain(outer_context, CALL_MAINTAINS_NATIVE_CONTEXT);
Node* const effect = graph()->start(); Node* const effect = graph()->start();
Node* const control = graph()->start(); Node* const control = graph()->start();
Node* nested_context = Node* nested_context =
graph()->NewNode(op, graph()->start(), outer_context, effect, control); graph()->NewNode(op, graph()->start(), graph()->start(), outer_context,
frame_state_1, effect, control);
Node* const frame_state_2 = Node* const frame_state_2 =
ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT); ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT);
Node* node = Node* node =
......
...@@ -84,9 +84,15 @@ class JSTypeFeedbackTest : public TypedGraphTest { ...@@ -84,9 +84,15 @@ class JSTypeFeedbackTest : public TypedGraphTest {
Handle<Name> name = isolate()->factory()->InternalizeUtf8String(string); Handle<Name> name = isolate()->factory()->InternalizeUtf8String(string);
const Operator* op = javascript()->LoadGlobal(name, feedback); const Operator* op = javascript()->LoadGlobal(name, feedback);
Node* load = Node* load = graph()->NewNode(op, context, global, vector, context);
graph()->NewNode(op, context, global, vector, context, if (mode == JSTypeFeedbackSpecializer::kDeoptimizationEnabled) {
EmptyFrameState(), EmptyFrameState(), effect, control); for (int i = 0; i < OperatorProperties::GetFrameStateInputCount(op);
i++) {
load->AppendInput(zone(), EmptyFrameState());
}
}
load->AppendInput(zone(), effect);
load->AppendInput(zone(), control);
Node* if_success = graph()->NewNode(common()->IfSuccess(), load); Node* if_success = graph()->NewNode(common()->IfSuccess(), load);
return graph()->NewNode(common()->Return(), load, load, if_success); return graph()->NewNode(common()->Return(), load, load, if_success);
} }
......
...@@ -742,9 +742,13 @@ TEST_F(JSTypedLoweringTest, JSStorePropertyToExternalTypedArray) { ...@@ -742,9 +742,13 @@ TEST_F(JSTypedLoweringTest, JSStorePropertyToExternalTypedArray) {
Node* control = graph()->start(); Node* control = graph()->start();
VectorSlotPair feedback; VectorSlotPair feedback;
const Operator* op = javascript()->StoreProperty(language_mode, feedback); const Operator* op = javascript()->StoreProperty(language_mode, feedback);
Node* node = graph()->NewNode(op, base, key, value, vector, context, Node* node = graph()->NewNode(op, base, key, value, vector, context);
EmptyFrameState(), EmptyFrameState(), for (int i = 0;
effect, control); i < OperatorProperties::GetFrameStateInputCount(node->op()); i++) {
node->AppendInput(zone(), EmptyFrameState());
}
node->AppendInput(zone(), effect);
node->AppendInput(zone(), control);
Reduction r = Reduce(node); Reduction r = Reduce(node);
Matcher<Node*> offset_matcher = Matcher<Node*> offset_matcher =
...@@ -786,9 +790,13 @@ TEST_F(JSTypedLoweringTest, JSStorePropertyToExternalTypedArrayWithConversion) { ...@@ -786,9 +790,13 @@ TEST_F(JSTypedLoweringTest, JSStorePropertyToExternalTypedArrayWithConversion) {
Node* control = graph()->start(); Node* control = graph()->start();
VectorSlotPair feedback; VectorSlotPair feedback;
const Operator* op = javascript()->StoreProperty(language_mode, feedback); const Operator* op = javascript()->StoreProperty(language_mode, feedback);
Node* node = graph()->NewNode(op, base, key, value, vector, context, Node* node = graph()->NewNode(op, base, key, value, vector, context);
EmptyFrameState(), EmptyFrameState(), for (int i = 0;
effect, control); i < OperatorProperties::GetFrameStateInputCount(node->op()); i++) {
node->AppendInput(zone(), EmptyFrameState());
}
node->AppendInput(zone(), effect);
node->AppendInput(zone(), control);
Reduction r = Reduce(node); Reduction r = Reduce(node);
Matcher<Node*> offset_matcher = Matcher<Node*> offset_matcher =
...@@ -843,9 +851,13 @@ TEST_F(JSTypedLoweringTest, JSStorePropertyToExternalTypedArrayWithSafeKey) { ...@@ -843,9 +851,13 @@ TEST_F(JSTypedLoweringTest, JSStorePropertyToExternalTypedArrayWithSafeKey) {
Node* control = graph()->start(); Node* control = graph()->start();
VectorSlotPair feedback; VectorSlotPair feedback;
const Operator* op = javascript()->StoreProperty(language_mode, feedback); const Operator* op = javascript()->StoreProperty(language_mode, feedback);
Node* node = graph()->NewNode(op, base, key, value, vector, context, Node* node = graph()->NewNode(op, base, key, value, vector, context);
EmptyFrameState(), EmptyFrameState(), for (int i = 0;
effect, control); i < OperatorProperties::GetFrameStateInputCount(node->op()); i++) {
node->AppendInput(zone(), EmptyFrameState());
}
node->AppendInput(zone(), effect);
node->AppendInput(zone(), control);
Reduction r = Reduce(node); Reduction r = Reduce(node);
ASSERT_TRUE(r.Changed()); ASSERT_TRUE(r.Changed());
......
...@@ -64,10 +64,9 @@ class LivenessAnalysisTest : public GraphTest { ...@@ -64,10 +64,9 @@ class LivenessAnalysisTest : public GraphTest {
const Operator* op = common()->FrameState( const Operator* op = common()->FrameState(
BailoutId(ast_num), OutputFrameStateCombine::Ignore(), state_info); BailoutId(ast_num), OutputFrameStateCombine::Ignore(), state_info);
Node* result = Node* result = graph()->NewNode(op, empty_values_, locals, empty_values_,
graph()->NewNode(op, empty_values_, locals, empty_values_, jsgraph()->UndefinedConstant(),
jsgraph()->UndefinedConstant(), jsgraph()->UndefinedConstant());
jsgraph()->UndefinedConstant(), graph()->start());
current_block_->Checkpoint(result); current_block_->Checkpoint(result);
return result; return result;
......
...@@ -479,7 +479,7 @@ TEST_F(LoopPeelingTest, TwoExitLoopWithCall_nope) { ...@@ -479,7 +479,7 @@ TEST_F(LoopPeelingTest, TwoExitLoopWithCall_nope) {
Node* call = graph()->NewNode(&kMockCall, b1.if_true); Node* call = graph()->NewNode(&kMockCall, b1.if_true);
Node* if_success = graph()->NewNode(common()->IfSuccess(), call); Node* if_success = graph()->NewNode(common()->IfSuccess(), call);
Node* if_exception = graph()->NewNode( Node* if_exception = graph()->NewNode(
common()->IfException(IfExceptionHint::kLocallyUncaught), call, call); common()->IfException(IfExceptionHint::kLocallyUncaught), call);
loop->ReplaceInput(1, if_success); loop->ReplaceInput(1, if_success);
Node* merge = graph()->NewNode(common()->Merge(2), b1.if_false, if_exception); Node* merge = graph()->NewNode(common()->Merge(2), b1.if_false, if_exception);
......
...@@ -755,7 +755,7 @@ TARGET_TEST_F(SchedulerTest, NestedFloatingDiamonds) { ...@@ -755,7 +755,7 @@ TARGET_TEST_F(SchedulerTest, NestedFloatingDiamonds) {
Node* map = graph()->NewNode( Node* map = graph()->NewNode(
simplified()->LoadElement(AccessBuilder::ForFixedArrayElement()), p0, p0, simplified()->LoadElement(AccessBuilder::ForFixedArrayElement()), p0, p0,
start, f); p0, start, f);
Node* br1 = graph()->NewNode(common()->Branch(), map, graph()->start()); Node* br1 = graph()->NewNode(common()->Branch(), map, graph()->start());
Node* t1 = graph()->NewNode(common()->IfTrue(), br1); Node* t1 = graph()->NewNode(common()->IfTrue(), br1);
Node* f1 = graph()->NewNode(common()->IfFalse(), br1); Node* f1 = graph()->NewNode(common()->IfFalse(), br1);
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "src/codegen.h" #include "src/codegen.h"
#include "src/compiler/js-operator.h" #include "src/compiler/js-operator.h"
#include "src/compiler/node-properties.h" #include "src/compiler/node-properties.h"
#include "src/compiler/operator-properties.h"
#include "test/cctest/types-fuzz.h" #include "test/cctest/types-fuzz.h"
#include "test/unittests/compiler/graph-unittest.h" #include "test/unittests/compiler/graph-unittest.h"
...@@ -61,23 +60,8 @@ class TyperTest : public TypedGraphTest { ...@@ -61,23 +60,8 @@ class TyperTest : public TypedGraphTest {
Node* p1 = Parameter(1); Node* p1 = Parameter(1);
NodeProperties::SetType(p0, lhs); NodeProperties::SetType(p0, lhs);
NodeProperties::SetType(p1, rhs); NodeProperties::SetType(p1, rhs);
std::vector<Node*> inputs; Node* n = graph()->NewNode(op, p0, p1, context_node_, graph()->start(),
inputs.push_back(p0); graph()->start());
inputs.push_back(p1);
if (OperatorProperties::HasContextInput(op)) {
inputs.push_back(context_node_);
}
for (int i = 0; i < OperatorProperties::GetFrameStateInputCount(op); i++) {
inputs.push_back(EmptyFrameState());
}
for (int i = 0; i < op->EffectInputCount(); i++) {
inputs.push_back(graph()->start());
}
for (int i = 0; i < op->ControlInputCount(); i++) {
inputs.push_back(graph()->start());
}
Node* n = graph()->NewNode(op, static_cast<int>(inputs.size()),
&(inputs.front()));
return NodeProperties::GetType(n); return NodeProperties::GetType(n);
} }
......
...@@ -44,8 +44,8 @@ class ValueNumberingReducerTest : public TestWithZone { ...@@ -44,8 +44,8 @@ class ValueNumberingReducerTest : public TestWithZone {
TEST_F(ValueNumberingReducerTest, AllInputsAreChecked) { TEST_F(ValueNumberingReducerTest, AllInputsAreChecked) {
Node* na = graph()->NewNode(&kOp0); Node* na = graph()->NewNode(&kOp0);
Node* nb = graph()->NewNode(&kOp0); Node* nb = graph()->NewNode(&kOp0);
Node* n1 = graph()->NewNode(&kOp1, na); Node* n1 = graph()->NewNode(&kOp0, na);
Node* n2 = graph()->NewNode(&kOp1, nb); Node* n2 = graph()->NewNode(&kOp0, nb);
EXPECT_FALSE(Reduce(n1).Changed()); EXPECT_FALSE(Reduce(n1).Changed());
EXPECT_FALSE(Reduce(n2).Changed()); EXPECT_FALSE(Reduce(n2).Changed());
} }
......
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