[turbofan] Checking of input counts on node creation
This required fixing bunch of tests with wrong input counts. Review URL: https://codereview.chromium.org/1347353003 Cr-Commit-Position: refs/heads/master@{#30877}
This commit is contained in:
parent
aa491a10de
commit
260ec46efd
@ -81,11 +81,12 @@ BasicBlockProfiler::Data* BasicBlockInstrumentor::Instrument(
|
||||
// Construct increment operation.
|
||||
Node* base = graph->NewNode(
|
||||
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* store = graph->NewNode(
|
||||
machine.Store(StoreRepresentation(kMachUint32, kNoWriteBarrier)), base,
|
||||
zero, inc);
|
||||
zero, inc, graph->start(), graph->start());
|
||||
// Insert the new nodes.
|
||||
static const int kArraySize = 6;
|
||||
Node* to_insert[kArraySize] = {zero, one, base, load, inc, store};
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "src/base/bits.h"
|
||||
#include "src/compiler/node.h"
|
||||
#include "src/compiler/operator-properties.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
@ -43,7 +44,13 @@ void Graph::RemoveDecorator(GraphDecorator* decorator) {
|
||||
|
||||
Node* Graph::NewNode(const Operator* op, int input_count, Node** inputs,
|
||||
bool incomplete) {
|
||||
DCHECK_LE(op->ValueInputCount(), input_count);
|
||||
DCHECK_EQ(OperatorProperties::GetTotalInputCount(op), 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::New(zone(), NextNodeId(), op, input_count, inputs, incomplete);
|
||||
Decorate(node);
|
||||
|
@ -34,6 +34,10 @@ class Graph : public ZoneObject {
|
||||
explicit Graph(Zone* zone);
|
||||
|
||||
// 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,
|
||||
bool incomplete = false);
|
||||
|
||||
|
@ -32,7 +32,7 @@ RawMachineAssembler::RawMachineAssembler(Isolate* isolate, Graph* graph,
|
||||
parameters_ = zone()->NewArray<Node*>(param_count);
|
||||
for (size_t i = 0; i < parameter_count(); ++i) {
|
||||
parameters_[i] =
|
||||
NewNode(common()->Parameter(static_cast<int>(i)), graph->start());
|
||||
AddNode(common()->Parameter(static_cast<int>(i)), graph->start());
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ void RawMachineAssembler::Goto(Label* label) {
|
||||
void RawMachineAssembler::Branch(Node* condition, Label* true_val,
|
||||
Label* false_val) {
|
||||
DCHECK(current_block_ != schedule()->end());
|
||||
Node* branch = NewNode(common()->Branch(), condition);
|
||||
Node* branch = AddNode(common()->Branch(), condition);
|
||||
schedule()->AddBranch(CurrentBlock(), branch, Use(true_val), Use(false_val));
|
||||
current_block_ = nullptr;
|
||||
}
|
||||
@ -75,7 +75,7 @@ void RawMachineAssembler::Switch(Node* index, Label* default_label,
|
||||
size_t case_count) {
|
||||
DCHECK_NE(schedule()->end(), current_block_);
|
||||
size_t succ_count = case_count + 1;
|
||||
Node* switch_node = NewNode(common()->Switch(succ_count), index);
|
||||
Node* switch_node = AddNode(common()->Switch(succ_count), index);
|
||||
BasicBlock** succ_blocks = zone()->NewArray<BasicBlock*>(succ_count);
|
||||
for (size_t index = 0; index < case_count; ++index) {
|
||||
int32_t case_value = case_values[index];
|
||||
@ -95,7 +95,7 @@ void RawMachineAssembler::Switch(Node* index, Label* default_label,
|
||||
|
||||
|
||||
void RawMachineAssembler::Return(Node* value) {
|
||||
Node* ret = graph()->NewNode(common()->Return(), value);
|
||||
Node* ret = MakeNode(common()->Return(), 1, &value);
|
||||
schedule()->AddReturn(CurrentBlock(), ret);
|
||||
current_block_ = nullptr;
|
||||
}
|
||||
@ -114,9 +114,7 @@ Node* RawMachineAssembler::CallN(CallDescriptor* desc, Node* function,
|
||||
}
|
||||
buffer[index++] = graph()->start();
|
||||
buffer[index++] = graph()->start();
|
||||
Node* call = graph()->NewNode(common()->Call(desc), input_count, buffer);
|
||||
schedule()->AddNode(CurrentBlock(), call);
|
||||
return call;
|
||||
return AddNode(common()->Call(desc), input_count, buffer);
|
||||
}
|
||||
|
||||
|
||||
@ -136,9 +134,7 @@ Node* RawMachineAssembler::CallNWithFrameState(CallDescriptor* desc,
|
||||
buffer[index++] = frame_state;
|
||||
buffer[index++] = graph()->start();
|
||||
buffer[index++] = graph()->start();
|
||||
Node* call = graph()->NewNode(common()->Call(desc), input_count, buffer);
|
||||
schedule()->AddNode(CurrentBlock(), call);
|
||||
return call;
|
||||
return AddNode(common()->Call(desc), input_count, buffer);
|
||||
}
|
||||
|
||||
|
||||
@ -155,8 +151,7 @@ Node* RawMachineAssembler::TailCallN(CallDescriptor* desc, Node* function,
|
||||
}
|
||||
buffer[index++] = graph()->start();
|
||||
buffer[index++] = graph()->start();
|
||||
Node* tail_call =
|
||||
graph()->NewNode(common()->TailCall(desc), input_count, buffer);
|
||||
Node* tail_call = MakeNode(common()->TailCall(desc), input_count, buffer);
|
||||
schedule()->AddTailCall(CurrentBlock(), tail_call);
|
||||
return tail_call;
|
||||
}
|
||||
@ -170,11 +165,8 @@ Node* RawMachineAssembler::CallFunctionStub0(Node* function, Node* receiver,
|
||||
isolate(), zone(), callable.descriptor(), 1,
|
||||
CallDescriptor::kNeedsFrameState, Operator::kNoProperties);
|
||||
Node* stub_code = HeapConstant(callable.code());
|
||||
Node* call = graph()->NewNode(common()->Call(desc), stub_code, function,
|
||||
receiver, context, frame_state,
|
||||
graph()->start(), graph()->start());
|
||||
schedule()->AddNode(CurrentBlock(), call);
|
||||
return call;
|
||||
return AddNode(common()->Call(desc), stub_code, function, receiver, context,
|
||||
frame_state, graph()->start(), graph()->start());
|
||||
}
|
||||
|
||||
|
||||
@ -184,15 +176,12 @@ Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function,
|
||||
zone(), function, 1, Operator::kNoProperties, false);
|
||||
|
||||
Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode());
|
||||
Node* ref = NewNode(
|
||||
Node* ref = AddNode(
|
||||
common()->ExternalConstant(ExternalReference(function, isolate())));
|
||||
Node* arity = Int32Constant(1);
|
||||
|
||||
Node* call =
|
||||
graph()->NewNode(common()->Call(descriptor), centry, arg1, ref, arity,
|
||||
context, graph()->start(), graph()->start());
|
||||
schedule()->AddNode(CurrentBlock(), call);
|
||||
return call;
|
||||
return AddNode(common()->Call(descriptor), centry, arg1, ref, arity, context,
|
||||
graph()->start(), graph()->start());
|
||||
}
|
||||
|
||||
|
||||
@ -202,15 +191,12 @@ Node* RawMachineAssembler::CallRuntime2(Runtime::FunctionId function,
|
||||
zone(), function, 2, Operator::kNoProperties, false);
|
||||
|
||||
Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode());
|
||||
Node* ref = NewNode(
|
||||
Node* ref = AddNode(
|
||||
common()->ExternalConstant(ExternalReference(function, isolate())));
|
||||
Node* arity = Int32Constant(2);
|
||||
|
||||
Node* call =
|
||||
graph()->NewNode(common()->Call(descriptor), centry, arg1, arg2, ref,
|
||||
arity, context, graph()->start(), graph()->start());
|
||||
schedule()->AddNode(CurrentBlock(), call);
|
||||
return call;
|
||||
return AddNode(common()->Call(descriptor), centry, arg1, arg2, ref, arity,
|
||||
context, graph()->start(), graph()->start());
|
||||
}
|
||||
|
||||
|
||||
@ -221,10 +207,8 @@ Node* RawMachineAssembler::CallCFunction0(MachineType return_type,
|
||||
const CallDescriptor* descriptor =
|
||||
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
|
||||
|
||||
Node* call = graph()->NewNode(common()->Call(descriptor), function,
|
||||
graph()->start(), graph()->start());
|
||||
schedule()->AddNode(CurrentBlock(), call);
|
||||
return call;
|
||||
return AddNode(common()->Call(descriptor), function, graph()->start(),
|
||||
graph()->start());
|
||||
}
|
||||
|
||||
|
||||
@ -237,10 +221,8 @@ Node* RawMachineAssembler::CallCFunction1(MachineType return_type,
|
||||
const CallDescriptor* descriptor =
|
||||
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
|
||||
|
||||
Node* call = graph()->NewNode(common()->Call(descriptor), function, arg0,
|
||||
graph()->start(), graph()->start());
|
||||
schedule()->AddNode(CurrentBlock(), call);
|
||||
return call;
|
||||
return AddNode(common()->Call(descriptor), function, arg0, graph()->start(),
|
||||
graph()->start());
|
||||
}
|
||||
|
||||
|
||||
@ -255,10 +237,8 @@ Node* RawMachineAssembler::CallCFunction2(MachineType return_type,
|
||||
const CallDescriptor* descriptor =
|
||||
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
|
||||
|
||||
Node* call = graph()->NewNode(common()->Call(descriptor), function, arg0,
|
||||
arg1, graph()->start(), graph()->start());
|
||||
schedule()->AddNode(CurrentBlock(), call);
|
||||
return call;
|
||||
return AddNode(common()->Call(descriptor), function, arg0, arg1,
|
||||
graph()->start(), graph()->start());
|
||||
}
|
||||
|
||||
|
||||
@ -291,10 +271,7 @@ Node* RawMachineAssembler::CallCFunction8(
|
||||
graph()->start()};
|
||||
const CallDescriptor* descriptor =
|
||||
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
|
||||
Node* call =
|
||||
graph()->NewNode(common()->Call(descriptor), arraysize(args), args);
|
||||
schedule()->AddNode(CurrentBlock(), call);
|
||||
return call;
|
||||
return AddNode(common()->Call(descriptor), arraysize(args), args);
|
||||
}
|
||||
|
||||
|
||||
@ -324,15 +301,23 @@ BasicBlock* RawMachineAssembler::CurrentBlock() {
|
||||
}
|
||||
|
||||
|
||||
Node* RawMachineAssembler::MakeNode(const Operator* op, int input_count,
|
||||
Node** inputs) {
|
||||
Node* RawMachineAssembler::AddNode(const Operator* op, int input_count,
|
||||
Node** inputs) {
|
||||
DCHECK_NOT_NULL(schedule_);
|
||||
DCHECK(current_block_ != nullptr);
|
||||
Node* node = graph()->NewNode(op, input_count, inputs);
|
||||
Node* node = MakeNode(op, input_count, inputs);
|
||||
schedule()->AddNode(CurrentBlock(), 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 internal
|
||||
} // namespace v8
|
||||
|
@ -74,7 +74,7 @@ class RawMachineAssembler {
|
||||
|
||||
Node* UndefinedConstant() {
|
||||
Handle<HeapObject> undefined = isolate()->factory()->undefined_value();
|
||||
return NewNode(common()->HeapConstant(undefined));
|
||||
return AddNode(common()->HeapConstant(undefined));
|
||||
}
|
||||
|
||||
// Constants.
|
||||
@ -87,29 +87,29 @@ class RawMachineAssembler {
|
||||
: Int32Constant(static_cast<int>(value));
|
||||
}
|
||||
Node* Int32Constant(int32_t value) {
|
||||
return NewNode(common()->Int32Constant(value));
|
||||
return AddNode(common()->Int32Constant(value));
|
||||
}
|
||||
Node* Int64Constant(int64_t value) {
|
||||
return NewNode(common()->Int64Constant(value));
|
||||
return AddNode(common()->Int64Constant(value));
|
||||
}
|
||||
Node* NumberConstant(double value) {
|
||||
return NewNode(common()->NumberConstant(value));
|
||||
return AddNode(common()->NumberConstant(value));
|
||||
}
|
||||
Node* Float32Constant(float value) {
|
||||
return NewNode(common()->Float32Constant(value));
|
||||
return AddNode(common()->Float32Constant(value));
|
||||
}
|
||||
Node* Float64Constant(double value) {
|
||||
return NewNode(common()->Float64Constant(value));
|
||||
return AddNode(common()->Float64Constant(value));
|
||||
}
|
||||
Node* HeapConstant(Handle<HeapObject> object) {
|
||||
return NewNode(common()->HeapConstant(object));
|
||||
return AddNode(common()->HeapConstant(object));
|
||||
}
|
||||
Node* ExternalConstant(ExternalReference address) {
|
||||
return NewNode(common()->ExternalConstant(address));
|
||||
return AddNode(common()->ExternalConstant(address));
|
||||
}
|
||||
|
||||
Node* Projection(int index, Node* a) {
|
||||
return NewNode(common()->Projection(index), a);
|
||||
return AddNode(common()->Projection(index), a);
|
||||
}
|
||||
|
||||
// Memory Operations.
|
||||
@ -117,39 +117,39 @@ class RawMachineAssembler {
|
||||
return Load(rep, base, IntPtrConstant(0));
|
||||
}
|
||||
Node* Load(MachineType rep, Node* base, Node* index) {
|
||||
return NewNode(machine()->Load(rep), base, index, graph()->start(),
|
||||
return AddNode(machine()->Load(rep), base, index, graph()->start(),
|
||||
graph()->start());
|
||||
}
|
||||
Node* Store(MachineType rep, Node* base, Node* value) {
|
||||
return Store(rep, base, IntPtrConstant(0), value);
|
||||
}
|
||||
Node* Store(MachineType rep, Node* base, Node* index, Node* value) {
|
||||
return NewNode(machine()->Store(StoreRepresentation(rep, kNoWriteBarrier)),
|
||||
return AddNode(machine()->Store(StoreRepresentation(rep, kNoWriteBarrier)),
|
||||
base, index, value, graph()->start(), graph()->start());
|
||||
}
|
||||
|
||||
// Arithmetic Operations.
|
||||
Node* WordAnd(Node* a, Node* b) {
|
||||
return NewNode(machine()->WordAnd(), a, b);
|
||||
return AddNode(machine()->WordAnd(), a, b);
|
||||
}
|
||||
Node* WordOr(Node* a, Node* b) { return NewNode(machine()->WordOr(), a, b); }
|
||||
Node* WordOr(Node* a, Node* b) { return AddNode(machine()->WordOr(), a, b); }
|
||||
Node* WordXor(Node* a, Node* b) {
|
||||
return NewNode(machine()->WordXor(), a, b);
|
||||
return AddNode(machine()->WordXor(), a, b);
|
||||
}
|
||||
Node* WordShl(Node* a, Node* b) {
|
||||
return NewNode(machine()->WordShl(), a, b);
|
||||
return AddNode(machine()->WordShl(), a, b);
|
||||
}
|
||||
Node* WordShr(Node* a, Node* b) {
|
||||
return NewNode(machine()->WordShr(), a, b);
|
||||
return AddNode(machine()->WordShr(), a, b);
|
||||
}
|
||||
Node* WordSar(Node* a, Node* b) {
|
||||
return NewNode(machine()->WordSar(), a, b);
|
||||
return AddNode(machine()->WordSar(), a, b);
|
||||
}
|
||||
Node* WordRor(Node* a, Node* b) {
|
||||
return NewNode(machine()->WordRor(), a, b);
|
||||
return AddNode(machine()->WordRor(), a, b);
|
||||
}
|
||||
Node* WordEqual(Node* a, Node* b) {
|
||||
return NewNode(machine()->WordEqual(), a, b);
|
||||
return AddNode(machine()->WordEqual(), a, b);
|
||||
}
|
||||
Node* WordNotEqual(Node* a, Node* b) {
|
||||
return WordBinaryNot(WordEqual(a, b));
|
||||
@ -170,29 +170,29 @@ class RawMachineAssembler {
|
||||
}
|
||||
|
||||
Node* Word32And(Node* a, Node* b) {
|
||||
return NewNode(machine()->Word32And(), a, b);
|
||||
return AddNode(machine()->Word32And(), a, b);
|
||||
}
|
||||
Node* Word32Or(Node* a, Node* b) {
|
||||
return NewNode(machine()->Word32Or(), a, b);
|
||||
return AddNode(machine()->Word32Or(), a, b);
|
||||
}
|
||||
Node* Word32Xor(Node* a, Node* b) {
|
||||
return NewNode(machine()->Word32Xor(), a, b);
|
||||
return AddNode(machine()->Word32Xor(), a, b);
|
||||
}
|
||||
Node* Word32Shl(Node* a, Node* b) {
|
||||
return NewNode(machine()->Word32Shl(), a, b);
|
||||
return AddNode(machine()->Word32Shl(), a, b);
|
||||
}
|
||||
Node* Word32Shr(Node* a, Node* b) {
|
||||
return NewNode(machine()->Word32Shr(), a, b);
|
||||
return AddNode(machine()->Word32Shr(), a, b);
|
||||
}
|
||||
Node* Word32Sar(Node* a, Node* b) {
|
||||
return NewNode(machine()->Word32Sar(), a, b);
|
||||
return AddNode(machine()->Word32Sar(), a, b);
|
||||
}
|
||||
Node* Word32Ror(Node* a, Node* b) {
|
||||
return NewNode(machine()->Word32Ror(), a, b);
|
||||
return AddNode(machine()->Word32Ror(), a, b);
|
||||
}
|
||||
Node* Word32Clz(Node* a) { return NewNode(machine()->Word32Clz(), a); }
|
||||
Node* Word32Clz(Node* a) { return AddNode(machine()->Word32Clz(), a); }
|
||||
Node* Word32Equal(Node* a, Node* b) {
|
||||
return NewNode(machine()->Word32Equal(), a, b);
|
||||
return AddNode(machine()->Word32Equal(), a, b);
|
||||
}
|
||||
Node* Word32NotEqual(Node* a, Node* b) {
|
||||
return Word32BinaryNot(Word32Equal(a, b));
|
||||
@ -201,28 +201,28 @@ class RawMachineAssembler {
|
||||
Node* Word32BinaryNot(Node* a) { return Word32Equal(a, Int32Constant(0)); }
|
||||
|
||||
Node* Word64And(Node* a, Node* b) {
|
||||
return NewNode(machine()->Word64And(), a, b);
|
||||
return AddNode(machine()->Word64And(), a, b);
|
||||
}
|
||||
Node* Word64Or(Node* a, Node* b) {
|
||||
return NewNode(machine()->Word64Or(), a, b);
|
||||
return AddNode(machine()->Word64Or(), a, b);
|
||||
}
|
||||
Node* Word64Xor(Node* a, Node* b) {
|
||||
return NewNode(machine()->Word64Xor(), a, b);
|
||||
return AddNode(machine()->Word64Xor(), a, b);
|
||||
}
|
||||
Node* Word64Shl(Node* a, Node* b) {
|
||||
return NewNode(machine()->Word64Shl(), a, b);
|
||||
return AddNode(machine()->Word64Shl(), a, b);
|
||||
}
|
||||
Node* Word64Shr(Node* a, Node* b) {
|
||||
return NewNode(machine()->Word64Shr(), a, b);
|
||||
return AddNode(machine()->Word64Shr(), a, b);
|
||||
}
|
||||
Node* Word64Sar(Node* a, Node* b) {
|
||||
return NewNode(machine()->Word64Sar(), a, b);
|
||||
return AddNode(machine()->Word64Sar(), a, b);
|
||||
}
|
||||
Node* Word64Ror(Node* a, Node* b) {
|
||||
return NewNode(machine()->Word64Ror(), a, b);
|
||||
return AddNode(machine()->Word64Ror(), a, b);
|
||||
}
|
||||
Node* Word64Equal(Node* a, Node* b) {
|
||||
return NewNode(machine()->Word64Equal(), a, b);
|
||||
return AddNode(machine()->Word64Equal(), a, b);
|
||||
}
|
||||
Node* Word64NotEqual(Node* a, Node* b) {
|
||||
return Word64BinaryNot(Word64Equal(a, b));
|
||||
@ -231,49 +231,49 @@ class RawMachineAssembler {
|
||||
Node* Word64BinaryNot(Node* a) { return Word64Equal(a, Int64Constant(0)); }
|
||||
|
||||
Node* Int32Add(Node* a, Node* b) {
|
||||
return NewNode(machine()->Int32Add(), a, b);
|
||||
return AddNode(machine()->Int32Add(), a, b);
|
||||
}
|
||||
Node* Int32AddWithOverflow(Node* a, Node* b) {
|
||||
return NewNode(machine()->Int32AddWithOverflow(), a, b);
|
||||
return AddNode(machine()->Int32AddWithOverflow(), a, b);
|
||||
}
|
||||
Node* Int32Sub(Node* a, Node* b) {
|
||||
return NewNode(machine()->Int32Sub(), a, b);
|
||||
return AddNode(machine()->Int32Sub(), a, b);
|
||||
}
|
||||
Node* Int32SubWithOverflow(Node* a, Node* b) {
|
||||
return NewNode(machine()->Int32SubWithOverflow(), a, b);
|
||||
return AddNode(machine()->Int32SubWithOverflow(), a, b);
|
||||
}
|
||||
Node* Int32Mul(Node* a, Node* b) {
|
||||
return NewNode(machine()->Int32Mul(), a, b);
|
||||
return AddNode(machine()->Int32Mul(), a, b);
|
||||
}
|
||||
Node* Int32MulHigh(Node* a, Node* b) {
|
||||
return NewNode(machine()->Int32MulHigh(), a, b);
|
||||
return AddNode(machine()->Int32MulHigh(), a, b);
|
||||
}
|
||||
Node* Int32Div(Node* a, Node* b) {
|
||||
return NewNode(machine()->Int32Div(), a, b, graph()->start());
|
||||
return AddNode(machine()->Int32Div(), a, b, graph()->start());
|
||||
}
|
||||
Node* Int32Mod(Node* a, Node* b) {
|
||||
return NewNode(machine()->Int32Mod(), a, b, graph()->start());
|
||||
return AddNode(machine()->Int32Mod(), a, b, graph()->start());
|
||||
}
|
||||
Node* Int32LessThan(Node* a, Node* b) {
|
||||
return NewNode(machine()->Int32LessThan(), a, b);
|
||||
return AddNode(machine()->Int32LessThan(), a, b);
|
||||
}
|
||||
Node* Int32LessThanOrEqual(Node* a, Node* b) {
|
||||
return NewNode(machine()->Int32LessThanOrEqual(), a, b);
|
||||
return AddNode(machine()->Int32LessThanOrEqual(), a, b);
|
||||
}
|
||||
Node* Uint32Div(Node* a, Node* b) {
|
||||
return NewNode(machine()->Uint32Div(), a, b, graph()->start());
|
||||
return AddNode(machine()->Uint32Div(), a, b, graph()->start());
|
||||
}
|
||||
Node* Uint32LessThan(Node* a, Node* b) {
|
||||
return NewNode(machine()->Uint32LessThan(), a, b);
|
||||
return AddNode(machine()->Uint32LessThan(), a, b);
|
||||
}
|
||||
Node* Uint32LessThanOrEqual(Node* a, Node* b) {
|
||||
return NewNode(machine()->Uint32LessThanOrEqual(), a, b);
|
||||
return AddNode(machine()->Uint32LessThanOrEqual(), a, b);
|
||||
}
|
||||
Node* Uint32Mod(Node* a, Node* b) {
|
||||
return NewNode(machine()->Uint32Mod(), a, b, graph()->start());
|
||||
return AddNode(machine()->Uint32Mod(), a, b, graph()->start());
|
||||
}
|
||||
Node* Uint32MulHigh(Node* a, Node* b) {
|
||||
return NewNode(machine()->Uint32MulHigh(), a, b);
|
||||
return AddNode(machine()->Uint32MulHigh(), a, b);
|
||||
}
|
||||
Node* Int32GreaterThan(Node* a, Node* b) { return Int32LessThan(b, a); }
|
||||
Node* Int32GreaterThanOrEqual(Node* a, Node* b) {
|
||||
@ -282,42 +282,42 @@ class RawMachineAssembler {
|
||||
Node* Int32Neg(Node* a) { return Int32Sub(Int32Constant(0), a); }
|
||||
|
||||
Node* Int64Add(Node* a, Node* b) {
|
||||
return NewNode(machine()->Int64Add(), a, b);
|
||||
return AddNode(machine()->Int64Add(), a, b);
|
||||
}
|
||||
Node* Int64Sub(Node* a, Node* b) {
|
||||
return NewNode(machine()->Int64Sub(), a, b);
|
||||
return AddNode(machine()->Int64Sub(), a, b);
|
||||
}
|
||||
Node* Int64Mul(Node* a, Node* b) {
|
||||
return NewNode(machine()->Int64Mul(), a, b);
|
||||
return AddNode(machine()->Int64Mul(), a, b);
|
||||
}
|
||||
Node* Int64Div(Node* a, Node* b) {
|
||||
return NewNode(machine()->Int64Div(), a, b);
|
||||
return AddNode(machine()->Int64Div(), a, b);
|
||||
}
|
||||
Node* Int64Mod(Node* a, Node* b) {
|
||||
return NewNode(machine()->Int64Mod(), a, b);
|
||||
return AddNode(machine()->Int64Mod(), a, b);
|
||||
}
|
||||
Node* Int64Neg(Node* a) { return Int64Sub(Int64Constant(0), a); }
|
||||
Node* Int64LessThan(Node* a, Node* b) {
|
||||
return NewNode(machine()->Int64LessThan(), a, b);
|
||||
return AddNode(machine()->Int64LessThan(), a, b);
|
||||
}
|
||||
Node* Int64LessThanOrEqual(Node* a, Node* b) {
|
||||
return NewNode(machine()->Int64LessThanOrEqual(), a, b);
|
||||
return AddNode(machine()->Int64LessThanOrEqual(), a, b);
|
||||
}
|
||||
Node* Uint64LessThan(Node* a, Node* b) {
|
||||
return NewNode(machine()->Uint64LessThan(), a, b);
|
||||
return AddNode(machine()->Uint64LessThan(), a, b);
|
||||
}
|
||||
Node* Uint64LessThanOrEqual(Node* a, Node* b) {
|
||||
return NewNode(machine()->Uint64LessThanOrEqual(), a, b);
|
||||
return AddNode(machine()->Uint64LessThanOrEqual(), a, b);
|
||||
}
|
||||
Node* Int64GreaterThan(Node* a, Node* b) { return Int64LessThan(b, a); }
|
||||
Node* Int64GreaterThanOrEqual(Node* a, Node* b) {
|
||||
return Int64LessThanOrEqual(b, a);
|
||||
}
|
||||
Node* Uint64Div(Node* a, Node* b) {
|
||||
return NewNode(machine()->Uint64Div(), a, b);
|
||||
return AddNode(machine()->Uint64Div(), a, b);
|
||||
}
|
||||
Node* Uint64Mod(Node* a, Node* b) {
|
||||
return NewNode(machine()->Uint64Mod(), a, b);
|
||||
return AddNode(machine()->Uint64Mod(), a, b);
|
||||
}
|
||||
|
||||
#define INTPTR_BINOP(prefix, name) \
|
||||
@ -338,30 +338,30 @@ class RawMachineAssembler {
|
||||
#undef INTPTR_BINOP
|
||||
|
||||
Node* Float32Add(Node* a, Node* b) {
|
||||
return NewNode(machine()->Float32Add(), a, b);
|
||||
return AddNode(machine()->Float32Add(), a, b);
|
||||
}
|
||||
Node* Float32Sub(Node* a, Node* b) {
|
||||
return NewNode(machine()->Float32Sub(), a, b);
|
||||
return AddNode(machine()->Float32Sub(), a, b);
|
||||
}
|
||||
Node* Float32Mul(Node* a, Node* b) {
|
||||
return NewNode(machine()->Float32Mul(), a, b);
|
||||
return AddNode(machine()->Float32Mul(), a, b);
|
||||
}
|
||||
Node* Float32Div(Node* a, Node* b) {
|
||||
return NewNode(machine()->Float32Div(), a, b);
|
||||
return AddNode(machine()->Float32Div(), a, b);
|
||||
}
|
||||
Node* Float32Abs(Node* a) { return NewNode(machine()->Float32Abs(), a); }
|
||||
Node* Float32Sqrt(Node* a) { return NewNode(machine()->Float32Sqrt(), a); }
|
||||
Node* Float32Abs(Node* a) { return AddNode(machine()->Float32Abs(), a); }
|
||||
Node* Float32Sqrt(Node* a) { return AddNode(machine()->Float32Sqrt(), a); }
|
||||
Node* Float32Equal(Node* a, Node* b) {
|
||||
return NewNode(machine()->Float32Equal(), a, b);
|
||||
return AddNode(machine()->Float32Equal(), a, b);
|
||||
}
|
||||
Node* Float32NotEqual(Node* a, Node* b) {
|
||||
return WordBinaryNot(Float32Equal(a, b));
|
||||
}
|
||||
Node* Float32LessThan(Node* a, Node* b) {
|
||||
return NewNode(machine()->Float32LessThan(), a, b);
|
||||
return AddNode(machine()->Float32LessThan(), a, b);
|
||||
}
|
||||
Node* Float32LessThanOrEqual(Node* a, Node* b) {
|
||||
return NewNode(machine()->Float32LessThanOrEqual(), a, b);
|
||||
return AddNode(machine()->Float32LessThanOrEqual(), a, b);
|
||||
}
|
||||
Node* Float32GreaterThan(Node* a, Node* b) { return Float32LessThan(b, a); }
|
||||
Node* Float32GreaterThanOrEqual(Node* a, Node* b) {
|
||||
@ -369,33 +369,33 @@ class RawMachineAssembler {
|
||||
}
|
||||
|
||||
Node* Float64Add(Node* a, Node* b) {
|
||||
return NewNode(machine()->Float64Add(), a, b);
|
||||
return AddNode(machine()->Float64Add(), a, b);
|
||||
}
|
||||
Node* Float64Sub(Node* a, Node* b) {
|
||||
return NewNode(machine()->Float64Sub(), a, b);
|
||||
return AddNode(machine()->Float64Sub(), a, b);
|
||||
}
|
||||
Node* Float64Mul(Node* a, Node* b) {
|
||||
return NewNode(machine()->Float64Mul(), a, b);
|
||||
return AddNode(machine()->Float64Mul(), a, b);
|
||||
}
|
||||
Node* Float64Div(Node* a, Node* b) {
|
||||
return NewNode(machine()->Float64Div(), a, b);
|
||||
return AddNode(machine()->Float64Div(), a, b);
|
||||
}
|
||||
Node* Float64Mod(Node* a, Node* b) {
|
||||
return NewNode(machine()->Float64Mod(), a, b);
|
||||
return AddNode(machine()->Float64Mod(), a, b);
|
||||
}
|
||||
Node* Float64Abs(Node* a) { return NewNode(machine()->Float64Abs(), a); }
|
||||
Node* Float64Sqrt(Node* a) { return NewNode(machine()->Float64Sqrt(), a); }
|
||||
Node* Float64Abs(Node* a) { return AddNode(machine()->Float64Abs(), a); }
|
||||
Node* Float64Sqrt(Node* a) { return AddNode(machine()->Float64Sqrt(), a); }
|
||||
Node* Float64Equal(Node* a, Node* b) {
|
||||
return NewNode(machine()->Float64Equal(), a, b);
|
||||
return AddNode(machine()->Float64Equal(), a, b);
|
||||
}
|
||||
Node* Float64NotEqual(Node* a, Node* b) {
|
||||
return WordBinaryNot(Float64Equal(a, b));
|
||||
}
|
||||
Node* Float64LessThan(Node* a, Node* b) {
|
||||
return NewNode(machine()->Float64LessThan(), a, b);
|
||||
return AddNode(machine()->Float64LessThan(), a, b);
|
||||
}
|
||||
Node* Float64LessThanOrEqual(Node* a, Node* b) {
|
||||
return NewNode(machine()->Float64LessThanOrEqual(), a, b);
|
||||
return AddNode(machine()->Float64LessThanOrEqual(), a, b);
|
||||
}
|
||||
Node* Float64GreaterThan(Node* a, Node* b) { return Float64LessThan(b, a); }
|
||||
Node* Float64GreaterThanOrEqual(Node* a, Node* b) {
|
||||
@ -404,74 +404,74 @@ class RawMachineAssembler {
|
||||
|
||||
// Conversions.
|
||||
Node* ChangeFloat32ToFloat64(Node* a) {
|
||||
return NewNode(machine()->ChangeFloat32ToFloat64(), a);
|
||||
return AddNode(machine()->ChangeFloat32ToFloat64(), a);
|
||||
}
|
||||
Node* ChangeInt32ToFloat64(Node* a) {
|
||||
return NewNode(machine()->ChangeInt32ToFloat64(), a);
|
||||
return AddNode(machine()->ChangeInt32ToFloat64(), a);
|
||||
}
|
||||
Node* ChangeUint32ToFloat64(Node* a) {
|
||||
return NewNode(machine()->ChangeUint32ToFloat64(), a);
|
||||
return AddNode(machine()->ChangeUint32ToFloat64(), a);
|
||||
}
|
||||
Node* ChangeFloat64ToInt32(Node* a) {
|
||||
return NewNode(machine()->ChangeFloat64ToInt32(), a);
|
||||
return AddNode(machine()->ChangeFloat64ToInt32(), a);
|
||||
}
|
||||
Node* ChangeFloat64ToUint32(Node* a) {
|
||||
return NewNode(machine()->ChangeFloat64ToUint32(), a);
|
||||
return AddNode(machine()->ChangeFloat64ToUint32(), a);
|
||||
}
|
||||
Node* ChangeInt32ToInt64(Node* a) {
|
||||
return NewNode(machine()->ChangeInt32ToInt64(), a);
|
||||
return AddNode(machine()->ChangeInt32ToInt64(), a);
|
||||
}
|
||||
Node* ChangeUint32ToUint64(Node* a) {
|
||||
return NewNode(machine()->ChangeUint32ToUint64(), a);
|
||||
return AddNode(machine()->ChangeUint32ToUint64(), a);
|
||||
}
|
||||
Node* TruncateFloat64ToFloat32(Node* a) {
|
||||
return NewNode(machine()->TruncateFloat64ToFloat32(), a);
|
||||
return AddNode(machine()->TruncateFloat64ToFloat32(), a);
|
||||
}
|
||||
Node* TruncateFloat64ToInt32(TruncationMode mode, Node* a) {
|
||||
return NewNode(machine()->TruncateFloat64ToInt32(mode), a);
|
||||
return AddNode(machine()->TruncateFloat64ToInt32(mode), a);
|
||||
}
|
||||
Node* TruncateInt64ToInt32(Node* a) {
|
||||
return NewNode(machine()->TruncateInt64ToInt32(), a);
|
||||
return AddNode(machine()->TruncateInt64ToInt32(), a);
|
||||
}
|
||||
Node* BitcastFloat32ToInt32(Node* a) {
|
||||
return NewNode(machine()->BitcastFloat32ToInt32(), a);
|
||||
return AddNode(machine()->BitcastFloat32ToInt32(), a);
|
||||
}
|
||||
Node* BitcastFloat64ToInt64(Node* a) {
|
||||
return NewNode(machine()->BitcastFloat64ToInt64(), a);
|
||||
return AddNode(machine()->BitcastFloat64ToInt64(), a);
|
||||
}
|
||||
Node* BitcastInt32ToFloat32(Node* a) {
|
||||
return NewNode(machine()->BitcastInt32ToFloat32(), a);
|
||||
return AddNode(machine()->BitcastInt32ToFloat32(), a);
|
||||
}
|
||||
Node* BitcastInt64ToFloat64(Node* a) {
|
||||
return NewNode(machine()->BitcastInt64ToFloat64(), a);
|
||||
return AddNode(machine()->BitcastInt64ToFloat64(), a);
|
||||
}
|
||||
Node* Float64RoundDown(Node* a) {
|
||||
return NewNode(machine()->Float64RoundDown().op(), a);
|
||||
return AddNode(machine()->Float64RoundDown().op(), a);
|
||||
}
|
||||
Node* Float64RoundTruncate(Node* a) {
|
||||
return NewNode(machine()->Float64RoundTruncate().op(), a);
|
||||
return AddNode(machine()->Float64RoundTruncate().op(), a);
|
||||
}
|
||||
Node* Float64RoundTiesAway(Node* a) {
|
||||
return NewNode(machine()->Float64RoundTiesAway().op(), a);
|
||||
return AddNode(machine()->Float64RoundTiesAway().op(), a);
|
||||
}
|
||||
|
||||
// Float64 bit operations.
|
||||
Node* Float64ExtractLowWord32(Node* a) {
|
||||
return NewNode(machine()->Float64ExtractLowWord32(), a);
|
||||
return AddNode(machine()->Float64ExtractLowWord32(), a);
|
||||
}
|
||||
Node* Float64ExtractHighWord32(Node* a) {
|
||||
return NewNode(machine()->Float64ExtractHighWord32(), a);
|
||||
return AddNode(machine()->Float64ExtractHighWord32(), a);
|
||||
}
|
||||
Node* Float64InsertLowWord32(Node* a, Node* b) {
|
||||
return NewNode(machine()->Float64InsertLowWord32(), a, b);
|
||||
return AddNode(machine()->Float64InsertLowWord32(), a, b);
|
||||
}
|
||||
Node* Float64InsertHighWord32(Node* a, Node* b) {
|
||||
return NewNode(machine()->Float64InsertHighWord32(), a, b);
|
||||
return AddNode(machine()->Float64InsertHighWord32(), a, b);
|
||||
}
|
||||
|
||||
// Stack operations.
|
||||
Node* LoadStackPointer() { return NewNode(machine()->LoadStackPointer()); }
|
||||
Node* LoadFramePointer() { return NewNode(machine()->LoadFramePointer()); }
|
||||
Node* LoadStackPointer() { return AddNode(machine()->LoadStackPointer()); }
|
||||
Node* LoadFramePointer() { return AddNode(machine()->LoadFramePointer()); }
|
||||
|
||||
// Parameters.
|
||||
Node* Parameter(size_t index);
|
||||
@ -535,13 +535,13 @@ class RawMachineAssembler {
|
||||
|
||||
// Variables.
|
||||
Node* Phi(MachineType type, Node* n1, Node* n2) {
|
||||
return NewNode(common()->Phi(type, 2), n1, n2);
|
||||
return AddNode(common()->Phi(type, 2), n1, n2);
|
||||
}
|
||||
Node* Phi(MachineType type, Node* n1, Node* n2, Node* n3) {
|
||||
return NewNode(common()->Phi(type, 3), n1, n2, n3);
|
||||
return AddNode(common()->Phi(type, 3), n1, n2, n3);
|
||||
}
|
||||
Node* Phi(MachineType type, Node* n1, Node* n2, Node* n3, Node* n4) {
|
||||
return NewNode(common()->Phi(type, 4), n1, n2, n3, n4);
|
||||
return AddNode(common()->Phi(type, 4), n1, n2, n3, n4);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@ -549,42 +549,18 @@ class RawMachineAssembler {
|
||||
// are not covered by the above utility methods. There should rarely be a need
|
||||
// to do that outside of testing though.
|
||||
|
||||
Node* NewNode(const Operator* op) {
|
||||
return MakeNode(op, 0, static_cast<Node**>(NULL));
|
||||
Node* AddNode(const Operator* op, int input_count, Node** inputs);
|
||||
|
||||
Node* AddNode(const Operator* op) {
|
||||
return AddNode(op, 0, static_cast<Node**>(nullptr));
|
||||
}
|
||||
|
||||
Node* NewNode(const Operator* op, Node* n1) { return MakeNode(op, 1, &n1); }
|
||||
Node* AddNode(const Operator* op, Node* n1) { return AddNode(op, 1, &n1); }
|
||||
|
||||
Node* NewNode(const Operator* op, Node* n1, Node* n2) {
|
||||
Node* buffer[] = {n1, n2};
|
||||
return MakeNode(op, arraysize(buffer), buffer);
|
||||
}
|
||||
|
||||
Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3) {
|
||||
Node* buffer[] = {n1, n2, n3};
|
||||
return MakeNode(op, arraysize(buffer), buffer);
|
||||
}
|
||||
|
||||
Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4) {
|
||||
Node* buffer[] = {n1, n2, n3, n4};
|
||||
return MakeNode(op, arraysize(buffer), buffer);
|
||||
}
|
||||
|
||||
Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4,
|
||||
Node* n5) {
|
||||
Node* buffer[] = {n1, n2, n3, n4, n5};
|
||||
return MakeNode(op, arraysize(buffer), buffer);
|
||||
}
|
||||
|
||||
Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4,
|
||||
Node* n5, Node* n6) {
|
||||
Node* nodes[] = {n1, n2, n3, n4, n5, n6};
|
||||
return MakeNode(op, arraysize(nodes), nodes);
|
||||
}
|
||||
|
||||
Node* NewNode(const Operator* op, int value_input_count,
|
||||
Node** value_inputs) {
|
||||
return MakeNode(op, value_input_count, value_inputs);
|
||||
template <class... TArgs>
|
||||
Node* AddNode(const Operator* op, Node* n1, Node* n2, TArgs... args) {
|
||||
Node* buffer[] = {n1, n2, args...};
|
||||
return AddNode(op, arraysize(buffer), buffer);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -266,9 +266,12 @@ class RepresentationSelector {
|
||||
// Helper for binops of the R x L -> O variety.
|
||||
void VisitBinop(Node* node, MachineTypeUnion left_use,
|
||||
MachineTypeUnion right_use, MachineTypeUnion output) {
|
||||
DCHECK_EQ(2, node->InputCount());
|
||||
DCHECK_EQ(2, node->op()->ValueInputCount());
|
||||
ProcessInput(node, 0, left_use);
|
||||
ProcessInput(node, 1, right_use);
|
||||
for (int i = 2; i < node->InputCount(); i++) {
|
||||
Enqueue(node->InputAt(i));
|
||||
}
|
||||
SetOutput(node, output);
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ class CompareWrapper {
|
||||
explicit CompareWrapper(IrOpcode::Value op) : opcode(op) {}
|
||||
|
||||
Node* MakeNode(RawMachineAssemblerTester<int32_t>* m, Node* a, Node* b) {
|
||||
return m->NewNode(op(m->machine()), a, b);
|
||||
return m->AddNode(op(m->machine()), a, b);
|
||||
}
|
||||
|
||||
const Operator* op(MachineOperatorBuilder* machine) {
|
||||
|
@ -20,8 +20,10 @@
|
||||
using namespace v8::internal;
|
||||
using namespace v8::internal::compiler;
|
||||
|
||||
static Operator dummy_operator(IrOpcode::kParameter, Operator::kNoWrite,
|
||||
"dummy", 0, 0, 0, 1, 0, 0);
|
||||
static Operator dummy_operator1(IrOpcode::kParameter, Operator::kNoWrite,
|
||||
"dummy", 1, 0, 0, 1, 0, 0);
|
||||
static Operator dummy_operator6(IrOpcode::kParameter, Operator::kNoWrite,
|
||||
"dummy", 6, 0, 0, 1, 0, 0);
|
||||
|
||||
|
||||
TEST(NodeWithNullInputReachableFromEnd) {
|
||||
@ -106,18 +108,18 @@ TEST(NodeNetworkOfDummiesReachableFromEnd) {
|
||||
|
||||
Node* start = graph.NewNode(common.Start(0));
|
||||
graph.SetStart(start);
|
||||
Node* n2 = graph.NewNode(&dummy_operator, graph.start());
|
||||
Node* n3 = graph.NewNode(&dummy_operator, graph.start());
|
||||
Node* n4 = graph.NewNode(&dummy_operator, n2);
|
||||
Node* n5 = graph.NewNode(&dummy_operator, n2);
|
||||
Node* n6 = graph.NewNode(&dummy_operator, n3);
|
||||
Node* n7 = graph.NewNode(&dummy_operator, n3);
|
||||
Node* n8 = graph.NewNode(&dummy_operator, n5);
|
||||
Node* n9 = graph.NewNode(&dummy_operator, n5);
|
||||
Node* n10 = graph.NewNode(&dummy_operator, n9);
|
||||
Node* n11 = graph.NewNode(&dummy_operator, n9);
|
||||
Node* n2 = graph.NewNode(&dummy_operator1, graph.start());
|
||||
Node* n3 = graph.NewNode(&dummy_operator1, graph.start());
|
||||
Node* n4 = graph.NewNode(&dummy_operator1, n2);
|
||||
Node* n5 = graph.NewNode(&dummy_operator1, n2);
|
||||
Node* n6 = graph.NewNode(&dummy_operator1, n3);
|
||||
Node* n7 = graph.NewNode(&dummy_operator1, n3);
|
||||
Node* n8 = graph.NewNode(&dummy_operator1, n5);
|
||||
Node* n9 = graph.NewNode(&dummy_operator1, n5);
|
||||
Node* n10 = graph.NewNode(&dummy_operator1, n9);
|
||||
Node* n11 = graph.NewNode(&dummy_operator1, n9);
|
||||
Node* end_dependencies[6] = {n4, n8, n10, n11, n6, n7};
|
||||
Node* end = graph.NewNode(&dummy_operator, 6, end_dependencies);
|
||||
Node* end = graph.NewNode(&dummy_operator6, 6, end_dependencies);
|
||||
graph.SetEnd(end);
|
||||
|
||||
OFStream os(stdout);
|
||||
|
@ -41,7 +41,8 @@ class JSConstantCacheTester : public HandleAndZoneScope,
|
||||
JSGraph(main_isolate(), &main_graph_, &main_common_, &main_javascript_,
|
||||
&main_machine_) {
|
||||
main_graph_.SetStart(main_graph_.NewNode(common()->Start(0)));
|
||||
main_graph_.SetEnd(main_graph_.NewNode(common()->End(1)));
|
||||
main_graph_.SetEnd(
|
||||
main_graph_.NewNode(common()->End(1), main_graph_.start()));
|
||||
main_typer_.Run();
|
||||
}
|
||||
|
||||
|
@ -140,24 +140,27 @@ TEST(ReduceJSStoreContext) {
|
||||
|
||||
{
|
||||
// Mutable slot, constant context, depth = 0 => do nothing.
|
||||
Node* load = t.graph()->NewNode(t.javascript()->StoreContext(0, 0),
|
||||
const_context, const_context, start);
|
||||
Node* load =
|
||||
t.graph()->NewNode(t.javascript()->StoreContext(0, 0), const_context,
|
||||
const_context, const_context, start, start);
|
||||
Reduction r = t.spec()->Reduce(load);
|
||||
CHECK(!r.Changed());
|
||||
}
|
||||
|
||||
{
|
||||
// Mutable slot, non-constant context, depth = 0 => do nothing.
|
||||
Node* load = t.graph()->NewNode(t.javascript()->StoreContext(0, 0),
|
||||
param_context, param_context, start);
|
||||
Node* load =
|
||||
t.graph()->NewNode(t.javascript()->StoreContext(0, 0), param_context,
|
||||
param_context, const_context, start, start);
|
||||
Reduction r = t.spec()->Reduce(load);
|
||||
CHECK(!r.Changed());
|
||||
}
|
||||
|
||||
{
|
||||
// Immutable slot, constant context, depth = 0 => do nothing.
|
||||
Node* load = t.graph()->NewNode(t.javascript()->StoreContext(0, slot),
|
||||
const_context, const_context, start);
|
||||
Node* load =
|
||||
t.graph()->NewNode(t.javascript()->StoreContext(0, slot), const_context,
|
||||
const_context, const_context, start, start);
|
||||
Reduction r = t.spec()->Reduce(load);
|
||||
CHECK(!r.Changed());
|
||||
}
|
||||
@ -166,7 +169,7 @@ TEST(ReduceJSStoreContext) {
|
||||
// Mutable slot, constant context, depth > 0 => fold-in parent context.
|
||||
Node* load = t.graph()->NewNode(
|
||||
t.javascript()->StoreContext(2, Context::GLOBAL_EVAL_FUN_INDEX),
|
||||
deep_const_context, deep_const_context, start);
|
||||
deep_const_context, deep_const_context, const_context, start, start);
|
||||
Reduction r = t.spec()->Reduce(load);
|
||||
CHECK(r.Changed());
|
||||
Node* new_context_input = NodeProperties::GetValueInput(r.replacement(), 0);
|
||||
@ -219,9 +222,10 @@ TEST(SpecializeToContext) {
|
||||
Node* other_use =
|
||||
t.graph()->NewNode(t.simplified()->ChangeTaggedToInt32(), other_load);
|
||||
|
||||
Node* add =
|
||||
t.graph()->NewNode(t.javascript()->Add(LanguageMode::SLOPPY), value_use,
|
||||
other_use, param_context, other_load, start);
|
||||
Node* add = t.graph()->NewNode(
|
||||
t.javascript()->Add(LanguageMode::SLOPPY), value_use, other_use,
|
||||
param_context, t.jsgraph()->EmptyFrameState(),
|
||||
t.jsgraph()->EmptyFrameState(), other_load, start);
|
||||
|
||||
Node* ret =
|
||||
t.graph()->NewNode(t.common()->Return(), add, effect_use, start);
|
||||
|
@ -41,7 +41,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
|
||||
typer(main_isolate(), &graph),
|
||||
context_node(NULL) {
|
||||
graph.SetStart(graph.NewNode(common.Start(num_parameters)));
|
||||
graph.SetEnd(graph.NewNode(common.End(1)));
|
||||
graph.SetEnd(graph.NewNode(common.End(1), graph.start()));
|
||||
typer.Run();
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
|
||||
Node* state_node = graph.NewNode(
|
||||
common.FrameState(BailoutId::None(), OutputFrameStateCombine::Ignore(),
|
||||
nullptr),
|
||||
parameters, locals, stack, context, UndefinedConstant());
|
||||
parameters, locals, stack, context, UndefinedConstant(), graph.start());
|
||||
|
||||
return state_node;
|
||||
}
|
||||
@ -125,16 +125,23 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
|
||||
|
||||
Node* Binop(const Operator* op, Node* left, Node* right) {
|
||||
// JS binops also require context, effect, and control
|
||||
if (OperatorProperties::GetFrameStateInputCount(op) == 1) {
|
||||
return graph.NewNode(op, left, right, context(),
|
||||
EmptyFrameState(context()), start(), control());
|
||||
} else if (OperatorProperties::GetFrameStateInputCount(op) == 2) {
|
||||
return graph.NewNode(op, left, right, context(),
|
||||
EmptyFrameState(context()),
|
||||
EmptyFrameState(context()), start(), control());
|
||||
} else {
|
||||
return graph.NewNode(op, left, right, context(), start(), control());
|
||||
std::vector<Node*> inputs;
|
||||
inputs.push_back(left);
|
||||
inputs.push_back(right);
|
||||
if (OperatorProperties::HasContextInput(op)) {
|
||||
inputs.push_back(context());
|
||||
}
|
||||
for (int i = 0; i < OperatorProperties::GetFrameStateInputCount(op); i++) {
|
||||
inputs.push_back(EmptyFrameState(context()));
|
||||
}
|
||||
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) {
|
||||
@ -828,15 +835,18 @@ void CheckEqualityReduction(JSTypedLoweringTester* R, bool strict, Node* l,
|
||||
Node* p1 = j == 1 ? l : r;
|
||||
|
||||
{
|
||||
Node* eq = strict ? R->graph.NewNode(R->javascript.StrictEqual(), p0, p1)
|
||||
: R->Binop(R->javascript.Equal(), p0, p1);
|
||||
Node* eq = strict
|
||||
? R->graph.NewNode(R->javascript.StrictEqual(), p0, p1,
|
||||
R->context())
|
||||
: R->Binop(R->javascript.Equal(), p0, p1);
|
||||
Node* r = R->reduce(eq);
|
||||
R->CheckPureBinop(expected, r);
|
||||
}
|
||||
|
||||
{
|
||||
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);
|
||||
Node* n = R->reduce(ne);
|
||||
CHECK_EQ(IrOpcode::kBooleanNot, n->opcode());
|
||||
|
@ -703,7 +703,8 @@ TEST(ReduceLoadStore) {
|
||||
|
||||
Node* base = R.Constant<int32_t>(11);
|
||||
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);
|
||||
@ -714,7 +715,7 @@ TEST(ReduceLoadStore) {
|
||||
{
|
||||
Node* store = R.graph.NewNode(
|
||||
R.machine.Store(StoreRepresentation(kMachInt32, kNoWriteBarrier)), base,
|
||||
index, load);
|
||||
index, load, load, load);
|
||||
MachineOperatorReducer reducer(&R.jsgraph);
|
||||
Reduction reduction = reducer.Reduce(store);
|
||||
CHECK(!reduction.Changed()); // stores should not be reduced.
|
||||
|
@ -16,8 +16,14 @@ using namespace v8::internal::compiler;
|
||||
|
||||
#define NONE reinterpret_cast<Node*>(1)
|
||||
|
||||
static Operator dummy_operator(IrOpcode::kParameter, Operator::kNoWrite,
|
||||
"dummy", 0, 0, 0, 1, 0, 0);
|
||||
static Operator dummy_operator0(IrOpcode::kParameter, Operator::kNoWrite,
|
||||
"dummy", 0, 0, 0, 1, 0, 0);
|
||||
static Operator dummy_operator1(IrOpcode::kParameter, Operator::kNoWrite,
|
||||
"dummy", 1, 0, 0, 1, 0, 0);
|
||||
static Operator dummy_operator2(IrOpcode::kParameter, Operator::kNoWrite,
|
||||
"dummy", 2, 0, 0, 1, 0, 0);
|
||||
static Operator dummy_operator3(IrOpcode::kParameter, Operator::kNoWrite,
|
||||
"dummy", 3, 0, 0, 1, 0, 0);
|
||||
|
||||
#define CHECK_USES(node, ...) \
|
||||
do { \
|
||||
@ -28,9 +34,12 @@ static Operator dummy_operator(IrOpcode::kParameter, Operator::kNoWrite,
|
||||
} while (false)
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
typedef std::multiset<Node*, std::less<Node*>> NodeMSet;
|
||||
|
||||
static void CheckUseChain(Node* node, Node** uses, int use_count) {
|
||||
|
||||
void CheckUseChain(Node* node, Node** uses, int use_count) {
|
||||
// Check ownership.
|
||||
if (use_count == 1) CHECK(node->OwnedBy(uses[0]));
|
||||
if (use_count > 1) {
|
||||
@ -82,16 +91,7 @@ static void CheckUseChain(Node* node, Node** uses, int use_count) {
|
||||
}
|
||||
|
||||
|
||||
#define CHECK_INPUTS(node, ...) \
|
||||
do { \
|
||||
Node* __array[] = {__VA_ARGS__}; \
|
||||
int __size = \
|
||||
__array[0] != NONE ? static_cast<int>(arraysize(__array)) : 0; \
|
||||
CheckInputs(node, __array, __size); \
|
||||
} while (false)
|
||||
|
||||
|
||||
static void CheckInputs(Node* node, Node** inputs, int input_count) {
|
||||
void CheckInputs(Node* node, Node** inputs, int input_count) {
|
||||
CHECK_EQ(input_count, node->InputCount());
|
||||
// Check InputAt().
|
||||
for (int i = 0; i < static_cast<int>(input_count); i++) {
|
||||
@ -129,14 +129,25 @@ static void CheckInputs(Node* node, Node** inputs, int input_count) {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
#define CHECK_INPUTS(node, ...) \
|
||||
do { \
|
||||
Node* __array[] = {__VA_ARGS__}; \
|
||||
int __size = \
|
||||
__array[0] != NONE ? static_cast<int>(arraysize(__array)) : 0; \
|
||||
CheckInputs(node, __array, __size); \
|
||||
} while (false)
|
||||
|
||||
|
||||
TEST(NodeUseIteratorReplaceUses) {
|
||||
Zone zone;
|
||||
Graph graph(&zone);
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n3 = graph.NewNode(&dummy_operator);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator1, n0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator1, n0);
|
||||
Node* n3 = graph.NewNode(&dummy_operator0);
|
||||
|
||||
CHECK_USES(n0, n1, n2);
|
||||
|
||||
@ -158,8 +169,8 @@ TEST(NodeUseIteratorReplaceUses) {
|
||||
TEST(NodeUseIteratorReplaceUsesSelf) {
|
||||
Zone zone;
|
||||
Graph graph(&zone);
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator1, n0);
|
||||
|
||||
CHECK_USES(n0, n1);
|
||||
CHECK_USES(n1, NONE);
|
||||
@ -169,7 +180,7 @@ TEST(NodeUseIteratorReplaceUsesSelf) {
|
||||
CHECK_USES(n0, NONE);
|
||||
CHECK_USES(n1, n1);
|
||||
|
||||
Node* n2 = graph.NewNode(&dummy_operator);
|
||||
Node* n2 = graph.NewNode(&dummy_operator0);
|
||||
|
||||
n1->ReplaceUses(n2);
|
||||
|
||||
@ -182,11 +193,11 @@ TEST(NodeUseIteratorReplaceUsesSelf) {
|
||||
TEST(ReplaceInput) {
|
||||
Zone zone;
|
||||
Graph graph(&zone);
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator);
|
||||
Node* n2 = graph.NewNode(&dummy_operator);
|
||||
Node* n3 = graph.NewNode(&dummy_operator, n0, n1, n2);
|
||||
Node* n4 = graph.NewNode(&dummy_operator);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator0);
|
||||
Node* n3 = graph.NewNode(&dummy_operator3, n0, n1, n2);
|
||||
Node* n4 = graph.NewNode(&dummy_operator0);
|
||||
|
||||
CHECK_USES(n0, n3);
|
||||
CHECK_USES(n1, n3);
|
||||
@ -210,17 +221,17 @@ TEST(OwnedBy) {
|
||||
Graph graph(&zone);
|
||||
|
||||
{
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator0);
|
||||
|
||||
CHECK(!n0->OwnedBy(n1));
|
||||
CHECK(!n1->OwnedBy(n0));
|
||||
|
||||
Node* n2 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator1, n0);
|
||||
CHECK(n0->OwnedBy(n2));
|
||||
CHECK(!n2->OwnedBy(n0));
|
||||
|
||||
Node* n3 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n3 = graph.NewNode(&dummy_operator1, n0);
|
||||
CHECK(!n0->OwnedBy(n2));
|
||||
CHECK(!n0->OwnedBy(n3));
|
||||
CHECK(!n2->OwnedBy(n0));
|
||||
@ -228,11 +239,11 @@ TEST(OwnedBy) {
|
||||
}
|
||||
|
||||
{
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator1, n0);
|
||||
CHECK(n0->OwnedBy(n1));
|
||||
CHECK(!n1->OwnedBy(n0));
|
||||
Node* n2 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator1, n0);
|
||||
CHECK(!n0->OwnedBy(n1));
|
||||
CHECK(!n0->OwnedBy(n2));
|
||||
CHECK(!n1->OwnedBy(n0));
|
||||
@ -240,7 +251,7 @@ TEST(OwnedBy) {
|
||||
CHECK(!n2->OwnedBy(n0));
|
||||
CHECK(!n2->OwnedBy(n1));
|
||||
|
||||
Node* n3 = graph.NewNode(&dummy_operator);
|
||||
Node* n3 = graph.NewNode(&dummy_operator0);
|
||||
n2->ReplaceInput(0, n3);
|
||||
|
||||
CHECK(n0->OwnedBy(n1));
|
||||
@ -259,18 +270,18 @@ TEST(Uses) {
|
||||
Zone zone;
|
||||
Graph graph(&zone);
|
||||
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator1, n0);
|
||||
|
||||
CHECK_USES(n0, n1);
|
||||
CHECK_USES(n1, NONE);
|
||||
|
||||
Node* n2 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator1, n0);
|
||||
|
||||
CHECK_USES(n0, n1, n2);
|
||||
CHECK_USES(n2, NONE);
|
||||
|
||||
Node* n3 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n3 = graph.NewNode(&dummy_operator1, n0);
|
||||
|
||||
CHECK_USES(n0, n1, n2, n3);
|
||||
CHECK_USES(n3, NONE);
|
||||
@ -281,14 +292,14 @@ TEST(Inputs) {
|
||||
Zone zone;
|
||||
Graph graph(&zone);
|
||||
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n3 = graph.NewNode(&dummy_operator, n0, n1, n2);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator1, n0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator1, n0);
|
||||
Node* n3 = graph.NewNode(&dummy_operator3, n0, n1, n2);
|
||||
|
||||
CHECK_INPUTS(n3, n0, n1, n2);
|
||||
|
||||
Node* n4 = graph.NewNode(&dummy_operator, n0, n1, n2);
|
||||
Node* n4 = graph.NewNode(&dummy_operator3, n0, n1, n2);
|
||||
n3->AppendInput(graph.zone(), n4);
|
||||
|
||||
CHECK_INPUTS(n3, n0, n1, n2, n4);
|
||||
@ -299,7 +310,7 @@ TEST(Inputs) {
|
||||
CHECK_INPUTS(n3, n0, n1, n2, n4, n4);
|
||||
CHECK_USES(n4, n3, n3);
|
||||
|
||||
Node* n5 = graph.NewNode(&dummy_operator, n4);
|
||||
Node* n5 = graph.NewNode(&dummy_operator1, n4);
|
||||
|
||||
CHECK_USES(n4, n3, n3, n5);
|
||||
}
|
||||
@ -309,9 +320,9 @@ TEST(RemoveInput) {
|
||||
Zone zone;
|
||||
Graph graph(&zone);
|
||||
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator, n0, n1);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator1, n0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator2, n0, n1);
|
||||
|
||||
CHECK_INPUTS(n0, NONE);
|
||||
CHECK_INPUTS(n1, n0);
|
||||
@ -339,16 +350,16 @@ TEST(AppendInputsAndIterator) {
|
||||
Zone zone;
|
||||
Graph graph(&zone);
|
||||
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator, n0, n1);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator1, n0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator2, n0, n1);
|
||||
|
||||
CHECK_INPUTS(n0, NONE);
|
||||
CHECK_INPUTS(n1, n0);
|
||||
CHECK_INPUTS(n2, n0, n1);
|
||||
CHECK_USES(n0, n1, n2);
|
||||
|
||||
Node* n3 = graph.NewNode(&dummy_operator);
|
||||
Node* n3 = graph.NewNode(&dummy_operator0);
|
||||
|
||||
n2->AppendInput(graph.zone(), n3);
|
||||
|
||||
@ -361,9 +372,9 @@ TEST(NullInputsSimple) {
|
||||
Zone zone;
|
||||
Graph graph(&zone);
|
||||
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator, n0, n1);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator1, n0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator2, n0, n1);
|
||||
|
||||
CHECK_INPUTS(n0, NONE);
|
||||
CHECK_INPUTS(n1, n0);
|
||||
@ -388,10 +399,10 @@ TEST(NullInputsAppended) {
|
||||
Zone zone;
|
||||
Graph graph(&zone);
|
||||
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n3 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator1, n0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator1, n0);
|
||||
Node* n3 = graph.NewNode(&dummy_operator1, n0);
|
||||
n3->AppendInput(graph.zone(), n1);
|
||||
n3->AppendInput(graph.zone(), n2);
|
||||
|
||||
@ -411,10 +422,10 @@ TEST(ReplaceUsesFromAppendedInputs) {
|
||||
Zone zone;
|
||||
Graph graph(&zone);
|
||||
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n3 = graph.NewNode(&dummy_operator);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator1, n0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator1, n0);
|
||||
Node* n3 = graph.NewNode(&dummy_operator0);
|
||||
|
||||
CHECK_INPUTS(n2, n0);
|
||||
|
||||
@ -439,14 +450,14 @@ TEST(ReplaceInputMultipleUses) {
|
||||
Zone zone;
|
||||
Graph graph(&zone);
|
||||
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator);
|
||||
Node* n2 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator1, n0);
|
||||
n2->ReplaceInput(0, n1);
|
||||
CHECK_EQ(0, n0->UseCount());
|
||||
CHECK_EQ(1, n1->UseCount());
|
||||
|
||||
Node* n3 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n3 = graph.NewNode(&dummy_operator1, n0);
|
||||
n3->ReplaceInput(0, n1);
|
||||
CHECK_EQ(0, n0->UseCount());
|
||||
CHECK_EQ(2, n1->UseCount());
|
||||
@ -458,25 +469,25 @@ TEST(TrimInputCountInline) {
|
||||
Graph graph(&zone);
|
||||
|
||||
{
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator1, n0);
|
||||
n1->TrimInputCount(1);
|
||||
CHECK_INPUTS(n1, n0);
|
||||
CHECK_USES(n0, n1);
|
||||
}
|
||||
|
||||
{
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator1, n0);
|
||||
n1->TrimInputCount(0);
|
||||
CHECK_INPUTS(n1, NONE);
|
||||
CHECK_USES(n0, NONE);
|
||||
}
|
||||
|
||||
{
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator);
|
||||
Node* n2 = graph.NewNode(&dummy_operator, n0, n1);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator2, n0, n1);
|
||||
n2->TrimInputCount(2);
|
||||
CHECK_INPUTS(n2, n0, n1);
|
||||
CHECK_USES(n0, n2);
|
||||
@ -484,9 +495,9 @@ TEST(TrimInputCountInline) {
|
||||
}
|
||||
|
||||
{
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator);
|
||||
Node* n2 = graph.NewNode(&dummy_operator, n0, n1);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator2, n0, n1);
|
||||
n2->TrimInputCount(1);
|
||||
CHECK_INPUTS(n2, n0);
|
||||
CHECK_USES(n0, n2);
|
||||
@ -494,9 +505,9 @@ TEST(TrimInputCountInline) {
|
||||
}
|
||||
|
||||
{
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator);
|
||||
Node* n2 = graph.NewNode(&dummy_operator, n0, n1);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator2, n0, n1);
|
||||
n2->TrimInputCount(0);
|
||||
CHECK_INPUTS(n2, NONE);
|
||||
CHECK_USES(n0, NONE);
|
||||
@ -504,16 +515,16 @@ TEST(TrimInputCountInline) {
|
||||
}
|
||||
|
||||
{
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n2 = graph.NewNode(&dummy_operator, n0, n0);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator2, n0, n0);
|
||||
n2->TrimInputCount(1);
|
||||
CHECK_INPUTS(n2, n0);
|
||||
CHECK_USES(n0, n2);
|
||||
}
|
||||
|
||||
{
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n2 = graph.NewNode(&dummy_operator, n0, n0);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator2, n0, n0);
|
||||
n2->TrimInputCount(0);
|
||||
CHECK_INPUTS(n2, NONE);
|
||||
CHECK_USES(n0, NONE);
|
||||
@ -526,8 +537,8 @@ TEST(TrimInputCountOutOfLine1) {
|
||||
Graph graph(&zone);
|
||||
|
||||
{
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator0);
|
||||
n1->AppendInput(graph.zone(), n0);
|
||||
CHECK_INPUTS(n1, n0);
|
||||
CHECK_USES(n0, n1);
|
||||
@ -538,8 +549,8 @@ TEST(TrimInputCountOutOfLine1) {
|
||||
}
|
||||
|
||||
{
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator0);
|
||||
n1->AppendInput(graph.zone(), n0);
|
||||
CHECK_EQ(1, n1->InputCount());
|
||||
n1->TrimInputCount(0);
|
||||
@ -548,9 +559,9 @@ TEST(TrimInputCountOutOfLine1) {
|
||||
}
|
||||
|
||||
{
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator);
|
||||
Node* n2 = graph.NewNode(&dummy_operator);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator0);
|
||||
n2->AppendInput(graph.zone(), n0);
|
||||
n2->AppendInput(graph.zone(), n1);
|
||||
CHECK_INPUTS(n2, n0, n1);
|
||||
@ -562,9 +573,9 @@ TEST(TrimInputCountOutOfLine1) {
|
||||
}
|
||||
|
||||
{
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator);
|
||||
Node* n2 = graph.NewNode(&dummy_operator);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator0);
|
||||
n2->AppendInput(graph.zone(), n0);
|
||||
n2->AppendInput(graph.zone(), n1);
|
||||
CHECK_INPUTS(n2, n0, n1);
|
||||
@ -576,9 +587,9 @@ TEST(TrimInputCountOutOfLine1) {
|
||||
}
|
||||
|
||||
{
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator);
|
||||
Node* n2 = graph.NewNode(&dummy_operator);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator0);
|
||||
n2->AppendInput(graph.zone(), n0);
|
||||
n2->AppendInput(graph.zone(), n1);
|
||||
CHECK_INPUTS(n2, n0, n1);
|
||||
@ -590,8 +601,8 @@ TEST(TrimInputCountOutOfLine1) {
|
||||
}
|
||||
|
||||
{
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n2 = graph.NewNode(&dummy_operator);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator0);
|
||||
n2->AppendInput(graph.zone(), n0);
|
||||
n2->AppendInput(graph.zone(), n0);
|
||||
CHECK_INPUTS(n2, n0, n0);
|
||||
@ -602,8 +613,8 @@ TEST(TrimInputCountOutOfLine1) {
|
||||
}
|
||||
|
||||
{
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n2 = graph.NewNode(&dummy_operator);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator0);
|
||||
n2->AppendInput(graph.zone(), n0);
|
||||
n2->AppendInput(graph.zone(), n0);
|
||||
CHECK_INPUTS(n2, n0, n0);
|
||||
@ -620,9 +631,9 @@ TEST(TrimInputCountOutOfLine2) {
|
||||
Graph graph(&zone);
|
||||
|
||||
{
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator);
|
||||
Node* n2 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator1, n0);
|
||||
n2->AppendInput(graph.zone(), n1);
|
||||
CHECK_INPUTS(n2, n0, n1);
|
||||
n2->TrimInputCount(2);
|
||||
@ -633,9 +644,9 @@ TEST(TrimInputCountOutOfLine2) {
|
||||
}
|
||||
|
||||
{
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator);
|
||||
Node* n2 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator1, n0);
|
||||
n2->AppendInput(graph.zone(), n1);
|
||||
CHECK_INPUTS(n2, n0, n1);
|
||||
n2->TrimInputCount(1);
|
||||
@ -646,9 +657,9 @@ TEST(TrimInputCountOutOfLine2) {
|
||||
}
|
||||
|
||||
{
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator);
|
||||
Node* n2 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator1, n0);
|
||||
n2->AppendInput(graph.zone(), n1);
|
||||
CHECK_INPUTS(n2, n0, n1);
|
||||
n2->TrimInputCount(0);
|
||||
@ -659,8 +670,8 @@ TEST(TrimInputCountOutOfLine2) {
|
||||
}
|
||||
|
||||
{
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n2 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator1, n0);
|
||||
n2->AppendInput(graph.zone(), n0);
|
||||
CHECK_INPUTS(n2, n0, n0);
|
||||
CHECK_USES(n0, n2, n2);
|
||||
@ -671,8 +682,8 @@ TEST(TrimInputCountOutOfLine2) {
|
||||
}
|
||||
|
||||
{
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n2 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n2 = graph.NewNode(&dummy_operator1, n0);
|
||||
n2->AppendInput(graph.zone(), n0);
|
||||
CHECK_EQ(2, n2->InputCount());
|
||||
CHECK_EQ(2, n0->UseCount());
|
||||
@ -689,14 +700,14 @@ TEST(NullAllInputs) {
|
||||
Graph graph(&zone);
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator1, n0);
|
||||
Node* n2;
|
||||
if (i == 0) {
|
||||
n2 = graph.NewNode(&dummy_operator, n0, n1);
|
||||
n2 = graph.NewNode(&dummy_operator2, n0, n1);
|
||||
CHECK_INPUTS(n2, n0, n1);
|
||||
} else {
|
||||
n2 = graph.NewNode(&dummy_operator, n0);
|
||||
n2 = graph.NewNode(&dummy_operator1, n0);
|
||||
CHECK_INPUTS(n2, n0);
|
||||
n2->AppendInput(graph.zone(), n1); // with out-of-line input.
|
||||
CHECK_INPUTS(n2, n0, n1);
|
||||
@ -718,8 +729,8 @@ TEST(NullAllInputs) {
|
||||
}
|
||||
|
||||
{
|
||||
Node* n0 = graph.NewNode(&dummy_operator);
|
||||
Node* n1 = graph.NewNode(&dummy_operator, n0);
|
||||
Node* n0 = graph.NewNode(&dummy_operator0);
|
||||
Node* n1 = graph.NewNode(&dummy_operator1, n0);
|
||||
n1->ReplaceInput(0, n1); // self-reference.
|
||||
|
||||
CHECK_INPUTS(n0, NONE);
|
||||
@ -741,13 +752,13 @@ TEST(AppendAndTrim) {
|
||||
Graph graph(&zone);
|
||||
|
||||
Node* nodes[] = {
|
||||
graph.NewNode(&dummy_operator), graph.NewNode(&dummy_operator),
|
||||
graph.NewNode(&dummy_operator), graph.NewNode(&dummy_operator),
|
||||
graph.NewNode(&dummy_operator)};
|
||||
graph.NewNode(&dummy_operator0), graph.NewNode(&dummy_operator0),
|
||||
graph.NewNode(&dummy_operator0), graph.NewNode(&dummy_operator0),
|
||||
graph.NewNode(&dummy_operator0)};
|
||||
|
||||
int max = static_cast<int>(arraysize(nodes));
|
||||
|
||||
Node* last = graph.NewNode(&dummy_operator);
|
||||
Node* last = graph.NewNode(&dummy_operator0);
|
||||
|
||||
for (int i = 0; i < max; i++) {
|
||||
last->AppendInput(graph.zone(), nodes[i]);
|
||||
|
@ -72,7 +72,7 @@ TEST(CodeGenInt32Binop) {
|
||||
RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
|
||||
Node* a = Int32Input(&m, j);
|
||||
Node* b = Int32Input(&m, k);
|
||||
m.Return(m.NewNode(kOps[i], a, b));
|
||||
m.Return(m.AddNode(kOps[i], a, b));
|
||||
m.GenerateCode();
|
||||
}
|
||||
}
|
||||
@ -132,7 +132,7 @@ TEST(CodeGenInt64Binop) {
|
||||
RawMachineAssemblerTester<int64_t> m(kMachInt64, kMachInt64);
|
||||
Node* a = Int64Input(&m, j);
|
||||
Node* b = Int64Input(&m, k);
|
||||
m.Return(m.NewNode(kOps[i], a, b));
|
||||
m.Return(m.AddNode(kOps[i], a, b));
|
||||
m.GenerateCode();
|
||||
}
|
||||
}
|
||||
@ -626,7 +626,7 @@ TEST(RunSwitch4) {
|
||||
m.Bind(&end);
|
||||
const int num_results = static_cast<int>(arraysize(results));
|
||||
Node* phi =
|
||||
m.NewNode(m.common()->Phi(kMachInt32, num_results), num_results, results);
|
||||
m.AddNode(m.common()->Phi(kMachInt32, num_results), num_results, results);
|
||||
m.Return(phi);
|
||||
|
||||
for (size_t i = 0; i < kNumValues; ++i) {
|
||||
@ -1053,7 +1053,7 @@ TEST(RunInt32AddInBranch) {
|
||||
kMachUint32);
|
||||
MLabel blocka, blockb;
|
||||
m.Branch(m.Word32Equal(m.Int32Add(m.Parameter(0),
|
||||
m.NewNode(shops[n], m.Parameter(1),
|
||||
m.AddNode(shops[n], m.Parameter(1),
|
||||
m.Parameter(2))),
|
||||
m.Int32Constant(0)),
|
||||
&blocka, &blockb);
|
||||
@ -1145,7 +1145,7 @@ TEST(RunInt32AddInComparison) {
|
||||
kMachUint32);
|
||||
m.Return(m.Word32Equal(
|
||||
m.Int32Add(m.Parameter(0),
|
||||
m.NewNode(shops[n], m.Parameter(1), m.Parameter(2))),
|
||||
m.AddNode(shops[n], m.Parameter(1), m.Parameter(2))),
|
||||
m.Int32Constant(0)));
|
||||
FOR_UINT32_INPUTS(i) {
|
||||
FOR_INT32_INPUTS(j) {
|
||||
@ -1390,7 +1390,7 @@ TEST(RunInt32SubInBranch) {
|
||||
kMachUint32);
|
||||
MLabel blocka, blockb;
|
||||
m.Branch(m.Word32Equal(m.Int32Sub(m.Parameter(0),
|
||||
m.NewNode(shops[n], m.Parameter(1),
|
||||
m.AddNode(shops[n], m.Parameter(1),
|
||||
m.Parameter(2))),
|
||||
m.Int32Constant(0)),
|
||||
&blocka, &blockb);
|
||||
@ -1482,7 +1482,7 @@ TEST(RunInt32SubInComparison) {
|
||||
kMachUint32);
|
||||
m.Return(m.Word32Equal(
|
||||
m.Int32Sub(m.Parameter(0),
|
||||
m.NewNode(shops[n], m.Parameter(1), m.Parameter(2))),
|
||||
m.AddNode(shops[n], m.Parameter(1), m.Parameter(2))),
|
||||
m.Int32Constant(0)));
|
||||
FOR_UINT32_INPUTS(i) {
|
||||
FOR_INT32_INPUTS(j) {
|
||||
@ -2059,7 +2059,7 @@ TEST(RunWord32AndInBranch) {
|
||||
kMachUint32);
|
||||
MLabel blocka, blockb;
|
||||
m.Branch(m.Word32Equal(m.Word32And(m.Parameter(0),
|
||||
m.NewNode(shops[n], m.Parameter(1),
|
||||
m.AddNode(shops[n], m.Parameter(1),
|
||||
m.Parameter(2))),
|
||||
m.Int32Constant(0)),
|
||||
&blocka, &blockb);
|
||||
@ -2287,7 +2287,7 @@ TEST(RunWord32OrInBranch) {
|
||||
kMachUint32);
|
||||
MLabel blocka, blockb;
|
||||
m.Branch(m.Word32Equal(m.Word32Or(m.Parameter(0),
|
||||
m.NewNode(shops[n], m.Parameter(1),
|
||||
m.AddNode(shops[n], m.Parameter(1),
|
||||
m.Parameter(2))),
|
||||
m.Int32Constant(0)),
|
||||
&blocka, &blockb);
|
||||
@ -2512,7 +2512,7 @@ TEST(RunWord32XorInBranch) {
|
||||
kMachUint32);
|
||||
MLabel blocka, blockb;
|
||||
m.Branch(m.Word32Equal(m.Word32Xor(m.Parameter(0),
|
||||
m.NewNode(shops[n], m.Parameter(1),
|
||||
m.AddNode(shops[n], m.Parameter(1),
|
||||
m.Parameter(2))),
|
||||
m.Int32Constant(0)),
|
||||
&blocka, &blockb);
|
||||
@ -3022,7 +3022,7 @@ TEST(RunDeadInt32Binops) {
|
||||
for (size_t i = 0; i < arraysize(kOps); ++i) {
|
||||
RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
|
||||
int32_t constant = static_cast<int32_t>(0x55555 + i);
|
||||
m.NewNode(kOps[i], m.Parameter(0), m.Parameter(1));
|
||||
m.AddNode(kOps[i], m.Parameter(0), m.Parameter(1));
|
||||
m.Return(m.Int32Constant(constant));
|
||||
|
||||
CHECK_EQ(constant, m.Call(1, 1));
|
||||
@ -3137,9 +3137,9 @@ TEST(RunFloat32Binop) {
|
||||
for (int i = 0; ops[i] != NULL; i++) {
|
||||
for (int j = 0; inputs[j] != NULL; j += 2) {
|
||||
RawMachineAssemblerTester<int32_t> m;
|
||||
Node* a = m.NewNode(inputs[j]);
|
||||
Node* b = m.NewNode(inputs[j + 1]);
|
||||
Node* binop = m.NewNode(ops[i], a, b);
|
||||
Node* a = m.AddNode(inputs[j]);
|
||||
Node* b = m.AddNode(inputs[j + 1]);
|
||||
Node* binop = m.AddNode(ops[i], a, b);
|
||||
Node* base = m.PointerConstant(&result);
|
||||
Node* zero = m.IntPtrConstant(0);
|
||||
m.Store(kMachFloat32, base, zero, binop);
|
||||
@ -3173,9 +3173,9 @@ TEST(RunFloat64Binop) {
|
||||
for (int i = 0; ops[i] != NULL; i++) {
|
||||
for (int j = 0; inputs[j] != NULL; j += 2) {
|
||||
RawMachineAssemblerTester<int32_t> m;
|
||||
Node* a = m.NewNode(inputs[j]);
|
||||
Node* b = m.NewNode(inputs[j + 1]);
|
||||
Node* binop = m.NewNode(ops[i], a, b);
|
||||
Node* a = m.AddNode(inputs[j]);
|
||||
Node* b = m.AddNode(inputs[j + 1]);
|
||||
Node* binop = m.AddNode(ops[i], a, b);
|
||||
Node* base = m.PointerConstant(&result);
|
||||
Node* zero = m.Int32Constant(0);
|
||||
m.Store(kMachFloat64, base, zero, binop);
|
||||
@ -3196,7 +3196,7 @@ TEST(RunDeadFloat32Binops) {
|
||||
for (int i = 0; ops[i] != NULL; i++) {
|
||||
RawMachineAssemblerTester<int32_t> m;
|
||||
int constant = 0x53355 + i;
|
||||
m.NewNode(ops[i], m.Float32Constant(0.1f), m.Float32Constant(1.11f));
|
||||
m.AddNode(ops[i], m.Float32Constant(0.1f), m.Float32Constant(1.11f));
|
||||
m.Return(m.Int32Constant(constant));
|
||||
CHECK_EQ(constant, m.Call());
|
||||
}
|
||||
@ -3213,7 +3213,7 @@ TEST(RunDeadFloat64Binops) {
|
||||
for (int i = 0; ops[i] != NULL; i++) {
|
||||
RawMachineAssemblerTester<int32_t> m;
|
||||
int constant = 0x53355 + i;
|
||||
m.NewNode(ops[i], m.Float64Constant(0.1), m.Float64Constant(1.11));
|
||||
m.AddNode(ops[i], m.Float64Constant(0.1), m.Float64Constant(1.11));
|
||||
m.Return(m.Int32Constant(constant));
|
||||
CHECK_EQ(constant, m.Call());
|
||||
}
|
||||
@ -4289,7 +4289,7 @@ TEST(RunFloat64UnorderedCompare) {
|
||||
Node* a = m.Float64Constant(*i);
|
||||
Node* b = m.Float64Constant(nan);
|
||||
if (j == 1) std::swap(a, b);
|
||||
m.Return(m.NewNode(operators[o], a, b));
|
||||
m.Return(m.AddNode(operators[o], a, b));
|
||||
CHECK_EQ(0, m.Call());
|
||||
}
|
||||
}
|
||||
@ -5287,7 +5287,7 @@ TEST(RunCheckedLoadInt64) {
|
||||
Node* index = m.Parameter(0);
|
||||
Node* length = m.Int32Constant(16);
|
||||
Node* load =
|
||||
m.NewNode(m.machine()->CheckedLoad(kMachInt64), base, index, length);
|
||||
m.AddNode(m.machine()->CheckedLoad(kMachInt64), base, index, length);
|
||||
m.Return(load);
|
||||
|
||||
CHECK_EQ(buffer[0], m.Call(0));
|
||||
@ -5305,7 +5305,7 @@ TEST(RunCheckedStoreInt64) {
|
||||
Node* index = m.Parameter(0);
|
||||
Node* length = m.Int32Constant(16);
|
||||
Node* value = m.Int64Constant(write);
|
||||
Node* store = m.NewNode(m.machine()->CheckedStore(kMachInt64), base, index,
|
||||
Node* store = m.AddNode(m.machine()->CheckedStore(kMachInt64), base, index,
|
||||
length, value);
|
||||
USE(store);
|
||||
m.Return(m.Int32Constant(11));
|
||||
|
@ -1219,7 +1219,10 @@ TEST(InsertBasicChanges) {
|
||||
static void CheckChangesAroundBinop(TestingGraph* t, const Operator* op,
|
||||
IrOpcode::Value input_change,
|
||||
IrOpcode::Value output_change) {
|
||||
Node* binop = t->graph()->NewNode(op, t->p0, t->p1);
|
||||
Node* binop =
|
||||
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->Lower();
|
||||
CHECK_EQ(input_change, binop->InputAt(0)->opcode());
|
||||
|
@ -290,7 +290,8 @@ const IfExceptionHint kNoHint = IfExceptionHint::kLocallyCaught;
|
||||
TEST_F(AdvancedReducerTest, ReplaceWithValue_ValueUse) {
|
||||
CommonOperatorBuilder common(zone());
|
||||
Node* node = graph()->NewNode(&kMockOperator);
|
||||
Node* use_value = graph()->NewNode(common.Return(), node);
|
||||
Node* start = graph()->NewNode(common.Start(1));
|
||||
Node* use_value = graph()->NewNode(common.Return(), node, start, start);
|
||||
Node* replacement = graph()->NewNode(&kMockOperator);
|
||||
GraphReducer graph_reducer(zone(), graph(), nullptr);
|
||||
ReplaceWithValueReducer r(&graph_reducer);
|
||||
@ -306,16 +307,18 @@ TEST_F(AdvancedReducerTest, ReplaceWithValue_EffectUse) {
|
||||
CommonOperatorBuilder common(zone());
|
||||
Node* start = graph()->NewNode(common.Start(1));
|
||||
Node* node = graph()->NewNode(&kMockOpEffect, start);
|
||||
Node* use_effect = graph()->NewNode(common.EffectPhi(1), node);
|
||||
Node* use_control = graph()->NewNode(common.Merge(1), start);
|
||||
Node* use_effect = graph()->NewNode(common.EffectPhi(1), node, use_control);
|
||||
Node* replacement = graph()->NewNode(&kMockOperator);
|
||||
GraphReducer graph_reducer(zone(), graph(), nullptr);
|
||||
ReplaceWithValueReducer r(&graph_reducer);
|
||||
r.ReplaceWithValue(node, replacement);
|
||||
EXPECT_EQ(start, use_effect->InputAt(0));
|
||||
EXPECT_EQ(0, node->UseCount());
|
||||
EXPECT_EQ(2, start->UseCount());
|
||||
EXPECT_EQ(3, start->UseCount());
|
||||
EXPECT_EQ(0, replacement->UseCount());
|
||||
EXPECT_THAT(start->uses(), UnorderedElementsAre(use_effect, node));
|
||||
EXPECT_THAT(start->uses(),
|
||||
UnorderedElementsAre(use_effect, use_control, node));
|
||||
}
|
||||
|
||||
|
||||
|
@ -248,7 +248,7 @@ TARGET_TEST_F(InstructionSelectorTest, ReferenceParameter) {
|
||||
TARGET_TEST_F(InstructionSelectorTest, Finish) {
|
||||
StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged);
|
||||
Node* param = m.Parameter(0);
|
||||
Node* finish = m.NewNode(m.common()->Finish(1), param, m.graph()->start());
|
||||
Node* finish = m.AddNode(m.common()->Finish(1), param, m.graph()->start());
|
||||
m.Return(finish);
|
||||
Stream s = m.Build(kAllInstructions);
|
||||
ASSERT_EQ(4U, s.size());
|
||||
@ -334,8 +334,8 @@ TARGET_TEST_F(InstructionSelectorTest, ValueEffect) {
|
||||
Stream s1 = m1.Build(kAllInstructions);
|
||||
StreamBuilder m2(this, kMachInt32, kMachPtr);
|
||||
Node* p2 = m2.Parameter(0);
|
||||
m2.Return(m2.NewNode(m2.machine()->Load(kMachInt32), p2, m2.Int32Constant(0),
|
||||
m2.NewNode(m2.common()->ValueEffect(1), p2)));
|
||||
m2.Return(m2.AddNode(m2.machine()->Load(kMachInt32), p2, m2.Int32Constant(0),
|
||||
m2.AddNode(m2.common()->ValueEffect(1), p2)));
|
||||
Stream s2 = m2.Build(kAllInstructions);
|
||||
EXPECT_LE(3U, s1.size());
|
||||
ASSERT_EQ(s1.size(), s2.size());
|
||||
@ -370,12 +370,12 @@ TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) {
|
||||
zone(), false, 1, CallDescriptor::kNeedsFrameState);
|
||||
|
||||
Node* parameters =
|
||||
m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(1));
|
||||
Node* locals = m.NewNode(m.common()->TypedStateValues(&empty_types));
|
||||
Node* stack = m.NewNode(m.common()->TypedStateValues(&empty_types));
|
||||
m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(1));
|
||||
Node* locals = m.AddNode(m.common()->TypedStateValues(&empty_types));
|
||||
Node* stack = m.AddNode(m.common()->TypedStateValues(&empty_types));
|
||||
Node* context_dummy = m.Int32Constant(0);
|
||||
|
||||
Node* state_node = m.NewNode(
|
||||
Node* state_node = m.AddNode(
|
||||
m.common()->FrameState(bailout_id, OutputFrameStateCombine::Push(),
|
||||
m.GetFrameStateFunctionInfo(1, 0)),
|
||||
parameters, locals, stack, context_dummy, function_node,
|
||||
@ -419,14 +419,14 @@ TARGET_TEST_F(InstructionSelectorTest, CallFunctionStubWithDeopt) {
|
||||
|
||||
// Build frame state for the state before the call.
|
||||
Node* parameters =
|
||||
m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(43));
|
||||
Node* locals = m.NewNode(m.common()->TypedStateValues(&float64_type),
|
||||
m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(43));
|
||||
Node* locals = m.AddNode(m.common()->TypedStateValues(&float64_type),
|
||||
m.Float64Constant(0.5));
|
||||
Node* stack = m.NewNode(m.common()->TypedStateValues(&tagged_type),
|
||||
Node* stack = m.AddNode(m.common()->TypedStateValues(&tagged_type),
|
||||
m.UndefinedConstant());
|
||||
|
||||
Node* context_sentinel = m.Int32Constant(0);
|
||||
Node* frame_state_before = m.NewNode(
|
||||
Node* frame_state_before = m.AddNode(
|
||||
m.common()->FrameState(bailout_id_before, OutputFrameStateCombine::Push(),
|
||||
m.GetFrameStateFunctionInfo(1, 1)),
|
||||
parameters, locals, stack, context_sentinel, function_node,
|
||||
@ -515,12 +515,12 @@ TARGET_TEST_F(InstructionSelectorTest,
|
||||
|
||||
// Build frame state for the state before the call.
|
||||
Node* parameters =
|
||||
m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(63));
|
||||
m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(63));
|
||||
Node* locals =
|
||||
m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(64));
|
||||
m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(64));
|
||||
Node* stack =
|
||||
m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(65));
|
||||
Node* frame_state_parent = m.NewNode(
|
||||
m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(65));
|
||||
Node* frame_state_parent = m.AddNode(
|
||||
m.common()->FrameState(bailout_id_parent,
|
||||
OutputFrameStateCombine::Ignore(),
|
||||
m.GetFrameStateFunctionInfo(1, 1)),
|
||||
@ -528,12 +528,12 @@ TARGET_TEST_F(InstructionSelectorTest,
|
||||
|
||||
Node* context2 = m.Int32Constant(46);
|
||||
Node* parameters2 =
|
||||
m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(43));
|
||||
Node* locals2 = m.NewNode(m.common()->TypedStateValues(&float64_type),
|
||||
m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(43));
|
||||
Node* locals2 = m.AddNode(m.common()->TypedStateValues(&float64_type),
|
||||
m.Float64Constant(0.25));
|
||||
Node* stack2 = m.NewNode(m.common()->TypedStateValues(&int32x2_type),
|
||||
Node* stack2 = m.AddNode(m.common()->TypedStateValues(&int32x2_type),
|
||||
m.Int32Constant(44), m.Int32Constant(45));
|
||||
Node* frame_state_before = m.NewNode(
|
||||
Node* frame_state_before = m.AddNode(
|
||||
m.common()->FrameState(bailout_id_before, OutputFrameStateCombine::Push(),
|
||||
m.GetFrameStateFunctionInfo(1, 1)),
|
||||
parameters2, locals2, stack2, context2, function_node,
|
||||
|
@ -153,13 +153,10 @@ TEST_F(JSContextRelaxationTest,
|
||||
Node* const context = Parameter(2);
|
||||
Node* const outer_context = Parameter(3);
|
||||
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 control = graph()->start();
|
||||
Node* nested_context =
|
||||
graph()->NewNode(op, graph()->start(), graph()->start(), outer_context,
|
||||
frame_state_1, effect, control);
|
||||
Node* nested_context = graph()->NewNode(
|
||||
op, graph()->start(), graph()->start(), outer_context, effect, control);
|
||||
Node* const frame_state_2 =
|
||||
ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT);
|
||||
Node* node =
|
||||
@ -205,13 +202,10 @@ TEST_F(JSContextRelaxationTest,
|
||||
Node* const context = Parameter(2);
|
||||
Node* const outer_context = Parameter(3);
|
||||
const Operator* op = javascript()->CreateBlockContext();
|
||||
Node* const frame_state_1 =
|
||||
ShallowFrameStateChain(outer_context, CALL_MAINTAINS_NATIVE_CONTEXT);
|
||||
Node* const effect = graph()->start();
|
||||
Node* const control = graph()->start();
|
||||
Node* nested_context =
|
||||
graph()->NewNode(op, graph()->start(), graph()->start(), outer_context,
|
||||
frame_state_1, effect, control);
|
||||
Node* nested_context = graph()->NewNode(
|
||||
op, graph()->start(), graph()->start(), outer_context, effect, control);
|
||||
Node* const frame_state_2 =
|
||||
ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT);
|
||||
Node* node =
|
||||
@ -257,13 +251,10 @@ TEST_F(JSContextRelaxationTest,
|
||||
Node* const context = Parameter(2);
|
||||
Node* const outer_context = Parameter(3);
|
||||
const Operator* op = javascript()->CreateModuleContext();
|
||||
Node* const frame_state_1 =
|
||||
ShallowFrameStateChain(outer_context, CALL_MAINTAINS_NATIVE_CONTEXT);
|
||||
Node* const effect = graph()->start();
|
||||
Node* const control = graph()->start();
|
||||
Node* nested_context =
|
||||
graph()->NewNode(op, graph()->start(), graph()->start(), outer_context,
|
||||
frame_state_1, effect, control);
|
||||
Node* nested_context = graph()->NewNode(
|
||||
op, graph()->start(), graph()->start(), outer_context, effect, control);
|
||||
Node* const frame_state_2 =
|
||||
ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT);
|
||||
Node* node =
|
||||
@ -283,13 +274,10 @@ TEST_F(JSContextRelaxationTest,
|
||||
Node* const context = Parameter(2);
|
||||
Node* const outer_context = Parameter(3);
|
||||
const Operator* op = javascript()->CreateFunctionContext();
|
||||
Node* const frame_state_1 =
|
||||
ShallowFrameStateChain(outer_context, CALL_MAINTAINS_NATIVE_CONTEXT);
|
||||
Node* const effect = graph()->start();
|
||||
Node* const control = graph()->start();
|
||||
Node* nested_context =
|
||||
graph()->NewNode(op, graph()->start(), graph()->start(), outer_context,
|
||||
frame_state_1, effect, control);
|
||||
graph()->NewNode(op, graph()->start(), outer_context, effect, control);
|
||||
Node* const frame_state_2 =
|
||||
ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT);
|
||||
Node* node =
|
||||
|
@ -84,15 +84,9 @@ class JSTypeFeedbackTest : public TypedGraphTest {
|
||||
|
||||
Handle<Name> name = isolate()->factory()->InternalizeUtf8String(string);
|
||||
const Operator* op = javascript()->LoadGlobal(name, feedback);
|
||||
Node* load = graph()->NewNode(op, context, global, vector, context);
|
||||
if (mode == JSTypeFeedbackSpecializer::kDeoptimizationEnabled) {
|
||||
for (int i = 0; i < OperatorProperties::GetFrameStateInputCount(op);
|
||||
i++) {
|
||||
load->AppendInput(zone(), EmptyFrameState());
|
||||
}
|
||||
}
|
||||
load->AppendInput(zone(), effect);
|
||||
load->AppendInput(zone(), control);
|
||||
Node* load =
|
||||
graph()->NewNode(op, context, global, vector, context,
|
||||
EmptyFrameState(), EmptyFrameState(), effect, control);
|
||||
Node* if_success = graph()->NewNode(common()->IfSuccess(), load);
|
||||
return graph()->NewNode(common()->Return(), load, load, if_success);
|
||||
}
|
||||
|
@ -742,13 +742,9 @@ TEST_F(JSTypedLoweringTest, JSStorePropertyToExternalTypedArray) {
|
||||
Node* control = graph()->start();
|
||||
VectorSlotPair feedback;
|
||||
const Operator* op = javascript()->StoreProperty(language_mode, feedback);
|
||||
Node* node = graph()->NewNode(op, base, key, value, vector, context);
|
||||
for (int i = 0;
|
||||
i < OperatorProperties::GetFrameStateInputCount(node->op()); i++) {
|
||||
node->AppendInput(zone(), EmptyFrameState());
|
||||
}
|
||||
node->AppendInput(zone(), effect);
|
||||
node->AppendInput(zone(), control);
|
||||
Node* node = graph()->NewNode(op, base, key, value, vector, context,
|
||||
EmptyFrameState(), EmptyFrameState(),
|
||||
effect, control);
|
||||
Reduction r = Reduce(node);
|
||||
|
||||
Matcher<Node*> offset_matcher =
|
||||
@ -790,13 +786,9 @@ TEST_F(JSTypedLoweringTest, JSStorePropertyToExternalTypedArrayWithConversion) {
|
||||
Node* control = graph()->start();
|
||||
VectorSlotPair feedback;
|
||||
const Operator* op = javascript()->StoreProperty(language_mode, feedback);
|
||||
Node* node = graph()->NewNode(op, base, key, value, vector, context);
|
||||
for (int i = 0;
|
||||
i < OperatorProperties::GetFrameStateInputCount(node->op()); i++) {
|
||||
node->AppendInput(zone(), EmptyFrameState());
|
||||
}
|
||||
node->AppendInput(zone(), effect);
|
||||
node->AppendInput(zone(), control);
|
||||
Node* node = graph()->NewNode(op, base, key, value, vector, context,
|
||||
EmptyFrameState(), EmptyFrameState(),
|
||||
effect, control);
|
||||
Reduction r = Reduce(node);
|
||||
|
||||
Matcher<Node*> offset_matcher =
|
||||
@ -851,13 +843,9 @@ TEST_F(JSTypedLoweringTest, JSStorePropertyToExternalTypedArrayWithSafeKey) {
|
||||
Node* control = graph()->start();
|
||||
VectorSlotPair feedback;
|
||||
const Operator* op = javascript()->StoreProperty(language_mode, feedback);
|
||||
Node* node = graph()->NewNode(op, base, key, value, vector, context);
|
||||
for (int i = 0;
|
||||
i < OperatorProperties::GetFrameStateInputCount(node->op()); i++) {
|
||||
node->AppendInput(zone(), EmptyFrameState());
|
||||
}
|
||||
node->AppendInput(zone(), effect);
|
||||
node->AppendInput(zone(), control);
|
||||
Node* node = graph()->NewNode(op, base, key, value, vector, context,
|
||||
EmptyFrameState(), EmptyFrameState(),
|
||||
effect, control);
|
||||
Reduction r = Reduce(node);
|
||||
|
||||
ASSERT_TRUE(r.Changed());
|
||||
|
@ -64,9 +64,10 @@ class LivenessAnalysisTest : public GraphTest {
|
||||
|
||||
const Operator* op = common()->FrameState(
|
||||
BailoutId(ast_num), OutputFrameStateCombine::Ignore(), state_info);
|
||||
Node* result = graph()->NewNode(op, empty_values_, locals, empty_values_,
|
||||
jsgraph()->UndefinedConstant(),
|
||||
jsgraph()->UndefinedConstant());
|
||||
Node* result =
|
||||
graph()->NewNode(op, empty_values_, locals, empty_values_,
|
||||
jsgraph()->UndefinedConstant(),
|
||||
jsgraph()->UndefinedConstant(), graph()->start());
|
||||
|
||||
current_block_->Checkpoint(result);
|
||||
return result;
|
||||
|
@ -479,7 +479,7 @@ TEST_F(LoopPeelingTest, TwoExitLoopWithCall_nope) {
|
||||
Node* call = graph()->NewNode(&kMockCall, b1.if_true);
|
||||
Node* if_success = graph()->NewNode(common()->IfSuccess(), call);
|
||||
Node* if_exception = graph()->NewNode(
|
||||
common()->IfException(IfExceptionHint::kLocallyUncaught), call);
|
||||
common()->IfException(IfExceptionHint::kLocallyUncaught), call, call);
|
||||
|
||||
loop->ReplaceInput(1, if_success);
|
||||
Node* merge = graph()->NewNode(common()->Merge(2), b1.if_false, if_exception);
|
||||
|
@ -755,7 +755,7 @@ TARGET_TEST_F(SchedulerTest, NestedFloatingDiamonds) {
|
||||
|
||||
Node* map = graph()->NewNode(
|
||||
simplified()->LoadElement(AccessBuilder::ForFixedArrayElement()), p0, p0,
|
||||
p0, start, f);
|
||||
start, f);
|
||||
Node* br1 = graph()->NewNode(common()->Branch(), map, graph()->start());
|
||||
Node* t1 = graph()->NewNode(common()->IfTrue(), br1);
|
||||
Node* f1 = graph()->NewNode(common()->IfFalse(), br1);
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "src/codegen.h"
|
||||
#include "src/compiler/js-operator.h"
|
||||
#include "src/compiler/node-properties.h"
|
||||
#include "src/compiler/operator-properties.h"
|
||||
#include "test/cctest/types-fuzz.h"
|
||||
#include "test/unittests/compiler/graph-unittest.h"
|
||||
|
||||
@ -60,8 +61,23 @@ class TyperTest : public TypedGraphTest {
|
||||
Node* p1 = Parameter(1);
|
||||
NodeProperties::SetType(p0, lhs);
|
||||
NodeProperties::SetType(p1, rhs);
|
||||
Node* n = graph()->NewNode(op, p0, p1, context_node_, graph()->start(),
|
||||
graph()->start());
|
||||
std::vector<Node*> inputs;
|
||||
inputs.push_back(p0);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -44,8 +44,8 @@ class ValueNumberingReducerTest : public TestWithZone {
|
||||
TEST_F(ValueNumberingReducerTest, AllInputsAreChecked) {
|
||||
Node* na = graph()->NewNode(&kOp0);
|
||||
Node* nb = graph()->NewNode(&kOp0);
|
||||
Node* n1 = graph()->NewNode(&kOp0, na);
|
||||
Node* n2 = graph()->NewNode(&kOp0, nb);
|
||||
Node* n1 = graph()->NewNode(&kOp1, na);
|
||||
Node* n2 = graph()->NewNode(&kOp1, nb);
|
||||
EXPECT_FALSE(Reduce(n1).Changed());
|
||||
EXPECT_FALSE(Reduce(n2).Changed());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user