Index: src/compiler/simplified-lowering.cc |
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc |
index 4e89d88c48253dbd187ba63a6fd7c1dde0411ee6..ecfba7f5fa264e6842815ed65b9a4584085c3fc5 100644 |
--- a/src/compiler/simplified-lowering.cc |
+++ b/src/compiler/simplified-lowering.cc |
@@ -368,7 +368,8 @@ class RepresentationSelector { |
SelectParameters p = SelectParametersOf(node->op()); |
MachineType type = static_cast<MachineType>(output_type); |
if (type != p.type()) { |
- node->set_op(lowering->common()->Select(type, p.hint())); |
+ NodeProperties::ChangeOp(node, |
+ lowering->common()->Select(type, p.hint())); |
} |
// Convert inputs to the output representation of this select. |
@@ -399,7 +400,7 @@ class RepresentationSelector { |
// Update the phi operator. |
MachineType type = static_cast<MachineType>(output_type); |
if (type != OpParameter<MachineType>(node)) { |
- node->set_op(lowering->common()->Phi(type, values)); |
+ NodeProperties::ChangeOp(node, lowering->common()->Phi(type, values)); |
} |
// Convert inputs to the output representation of this phi. |
@@ -453,7 +454,8 @@ class RepresentationSelector { |
MachineTypeUnion input_type = GetInfo(node->InputAt(i))->output; |
(*types)[i] = static_cast<MachineType>(input_type); |
} |
- node->set_op(jsgraph_->common()->TypedStateValues(types)); |
+ NodeProperties::ChangeOp(node, |
+ jsgraph_->common()->TypedStateValues(types)); |
} |
SetOutput(node, kMachAnyTagged); |
} |
@@ -583,12 +585,12 @@ class RepresentationSelector { |
MachineTypeUnion input = GetInfo(node->InputAt(0))->output; |
if (input & kRepBit) { |
// BooleanNot(x: kRepBit) => Word32Equal(x, #0) |
- node->set_op(lowering->machine()->Word32Equal()); |
node->AppendInput(jsgraph_->zone(), jsgraph_->Int32Constant(0)); |
+ NodeProperties::ChangeOp(node, lowering->machine()->Word32Equal()); |
} else { |
// BooleanNot(x: kRepTagged) => WordEqual(x, #false) |
- node->set_op(lowering->machine()->WordEqual()); |
node->AppendInput(jsgraph_->zone(), jsgraph_->FalseConstant()); |
+ NodeProperties::ChangeOp(node, lowering->machine()->WordEqual()); |
} |
} else { |
// No input representation requirement; adapt during lowering. |
@@ -605,8 +607,8 @@ class RepresentationSelector { |
DeferReplacement(node, node->InputAt(0)); |
} else { |
// BooleanToNumber(x: kRepTagged) => WordEqual(x, #true) |
- node->set_op(lowering->machine()->WordEqual()); |
node->AppendInput(jsgraph_->zone(), jsgraph_->TrueConstant()); |
+ NodeProperties::ChangeOp(node, lowering->machine()->WordEqual()); |
} |
} else { |
// No input representation requirement; adapt during lowering. |
@@ -622,15 +624,15 @@ class RepresentationSelector { |
if (BothInputsAre(node, Type::Signed32())) { |
// => signed Int32Cmp |
VisitInt32Cmp(node); |
- if (lower()) node->set_op(Int32Op(node)); |
+ if (lower()) NodeProperties::ChangeOp(node, Int32Op(node)); |
} else if (BothInputsAre(node, Type::Unsigned32())) { |
// => unsigned Int32Cmp |
VisitUint32Cmp(node); |
- if (lower()) node->set_op(Uint32Op(node)); |
+ if (lower()) NodeProperties::ChangeOp(node, Uint32Op(node)); |
} else { |
// => Float64Cmp |
VisitFloat64Cmp(node); |
- if (lower()) node->set_op(Float64Op(node)); |
+ if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); |
} |
break; |
} |
@@ -641,27 +643,27 @@ class RepresentationSelector { |
if (CanLowerToInt32Binop(node, use)) { |
// => signed Int32Add/Sub |
VisitInt32Binop(node); |
- if (lower()) node->set_op(Int32Op(node)); |
+ if (lower()) NodeProperties::ChangeOp(node, Int32Op(node)); |
} else if (CanLowerToInt32AdditiveBinop(node, use)) { |
// => signed Int32Add/Sub, truncating inputs |
ProcessTruncateWord32Input(node, 0, kTypeInt32); |
ProcessTruncateWord32Input(node, 1, kTypeInt32); |
SetOutput(node, kMachInt32); |
- if (lower()) node->set_op(Int32Op(node)); |
+ if (lower()) NodeProperties::ChangeOp(node, Int32Op(node)); |
} else if (CanLowerToUint32Binop(node, use)) { |
// => unsigned Int32Add/Sub |
VisitUint32Binop(node); |
- if (lower()) node->set_op(Uint32Op(node)); |
+ if (lower()) NodeProperties::ChangeOp(node, Uint32Op(node)); |
} else if (CanLowerToUint32AdditiveBinop(node, use)) { |
// => signed Int32Add/Sub, truncating inputs |
ProcessTruncateWord32Input(node, 0, kTypeUint32); |
ProcessTruncateWord32Input(node, 1, kTypeUint32); |
SetOutput(node, kMachUint32); |
- if (lower()) node->set_op(Uint32Op(node)); |
+ if (lower()) NodeProperties::ChangeOp(node, Uint32Op(node)); |
} else { |
// => Float64Add/Sub |
VisitFloat64Binop(node); |
- if (lower()) node->set_op(Float64Op(node)); |
+ if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); |
} |
break; |
} |
@@ -671,13 +673,13 @@ class RepresentationSelector { |
if (CanLowerToInt32Binop(node, use)) { |
// => signed Int32Mul |
VisitInt32Binop(node); |
- if (lower()) node->set_op(Int32Op(node)); |
+ if (lower()) NodeProperties::ChangeOp(node, Int32Op(node)); |
break; |
} |
} |
// => Float64Mul |
VisitFloat64Binop(node); |
- if (lower()) node->set_op(Float64Op(node)); |
+ if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); |
break; |
} |
case IrOpcode::kNumberDivide: { |
@@ -695,7 +697,7 @@ class RepresentationSelector { |
} |
// => Float64Div |
VisitFloat64Binop(node); |
- if (lower()) node->set_op(Float64Op(node)); |
+ if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); |
break; |
} |
case IrOpcode::kNumberModulus: { |
@@ -713,7 +715,7 @@ class RepresentationSelector { |
} |
// => Float64Mod |
VisitFloat64Binop(node); |
- if (lower()) node->set_op(Float64Op(node)); |
+ if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); |
break; |
} |
case IrOpcode::kNumberShiftLeft: { |
@@ -755,8 +757,9 @@ class RepresentationSelector { |
// TODO(turbofan): avoid a truncation with a smi check. |
VisitUnop(node, kTypeInt32 | kRepFloat64, kTypeInt32 | kRepWord32); |
if (lower()) { |
- node->set_op(lowering->machine()->TruncateFloat64ToInt32( |
- TruncationMode::kJavaScript)); |
+ NodeProperties::ChangeOp( |
+ node, lowering->machine()->TruncateFloat64ToInt32( |
+ TruncationMode::kJavaScript)); |
} |
} |
break; |
@@ -785,8 +788,9 @@ class RepresentationSelector { |
// TODO(turbofan): avoid a truncation with a smi check. |
VisitUnop(node, kTypeUint32 | kRepFloat64, kTypeUint32 | kRepWord32); |
if (lower()) { |
- node->set_op(lowering->machine()->TruncateFloat64ToInt32( |
- TruncationMode::kJavaScript)); |
+ NodeProperties::ChangeOp( |
+ node, lowering->machine()->TruncateFloat64ToInt32( |
+ TruncationMode::kJavaScript)); |
} |
} |
break; |
@@ -801,16 +805,18 @@ class RepresentationSelector { |
CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
jsgraph_->isolate(), jsgraph_->zone(), callable.descriptor(), 0, |
flags, properties); |
- node->set_op(jsgraph_->common()->Call(desc)); |
node->InsertInput(jsgraph_->zone(), 0, |
jsgraph_->HeapConstant(callable.code())); |
node->AppendInput(jsgraph_->zone(), jsgraph_->NoContextConstant()); |
+ NodeProperties::ChangeOp(node, jsgraph_->common()->Call(desc)); |
} |
break; |
} |
case IrOpcode::kReferenceEqual: { |
VisitBinop(node, kMachAnyTagged, kRepBit); |
- if (lower()) node->set_op(lowering->machine()->WordEqual()); |
+ if (lower()) { |
+ NodeProperties::ChangeOp(node, lowering->machine()->WordEqual()); |
+ } |
break; |
} |
case IrOpcode::kStringEqual: { |
@@ -1210,7 +1216,6 @@ void SimplifiedLowering::DoAllocate(Node* node) { |
Runtime::FunctionId f = Runtime::kAllocateInTargetSpace; |
Operator::Properties props = node->op()->properties(); |
CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(zone(), f, 2, props); |
- node->set_op(common()->Call(desc)); |
ExternalReference ref(f, jsgraph()->isolate()); |
int32_t flags = AllocateTargetSpace::encode(space); |
node->InsertInput(graph()->zone(), 0, jsgraph()->CEntryStubConstant(1)); |
@@ -1218,14 +1223,15 @@ void SimplifiedLowering::DoAllocate(Node* node) { |
node->InsertInput(graph()->zone(), 3, jsgraph()->ExternalConstant(ref)); |
node->InsertInput(graph()->zone(), 4, jsgraph()->Int32Constant(2)); |
node->InsertInput(graph()->zone(), 5, jsgraph()->NoContextConstant()); |
+ NodeProperties::ChangeOp(node, common()->Call(desc)); |
} |
void SimplifiedLowering::DoLoadField(Node* node) { |
const FieldAccess& access = FieldAccessOf(node->op()); |
- node->set_op(machine()->Load(access.machine_type)); |
Node* offset = jsgraph()->IntPtrConstant(access.offset - access.tag()); |
node->InsertInput(graph()->zone(), 1, offset); |
+ NodeProperties::ChangeOp(node, machine()->Load(access.machine_type)); |
} |
@@ -1234,10 +1240,10 @@ void SimplifiedLowering::DoStoreField(Node* node) { |
Type* type = NodeProperties::GetType(node->InputAt(1)); |
WriteBarrierKind kind = |
ComputeWriteBarrierKind(access.base_is_tagged, access.machine_type, type); |
- node->set_op( |
- machine()->Store(StoreRepresentation(access.machine_type, kind))); |
Node* offset = jsgraph()->IntPtrConstant(access.offset - access.tag()); |
node->InsertInput(graph()->zone(), 1, offset); |
+ NodeProperties::ChangeOp( |
+ node, machine()->Store(StoreRepresentation(access.machine_type, kind))); |
} |
@@ -1311,13 +1317,13 @@ void SimplifiedLowering::DoLoadBuffer(Node* node, MachineType output_type, |
NodeProperties::ReplaceUses(node, node, ephi); |
// Turn the {node} into a Phi. |
- node->set_op(common()->Phi(output_type, 2)); |
node->ReplaceInput(0, vtrue); |
node->ReplaceInput(1, vfalse); |
node->ReplaceInput(2, merge); |
node->TrimInputCount(3); |
+ NodeProperties::ChangeOp(node, common()->Phi(output_type, 2)); |
} else { |
- node->set_op(machine()->CheckedLoad(type)); |
+ NodeProperties::ChangeOp(node, machine()->CheckedLoad(type)); |
} |
} |
@@ -1325,25 +1331,26 @@ void SimplifiedLowering::DoLoadBuffer(Node* node, MachineType output_type, |
void SimplifiedLowering::DoStoreBuffer(Node* node) { |
DCHECK_EQ(IrOpcode::kStoreBuffer, node->opcode()); |
MachineType const type = BufferAccessOf(node->op()).machine_type(); |
- node->set_op(machine()->CheckedStore(type)); |
+ NodeProperties::ChangeOp(node, machine()->CheckedStore(type)); |
} |
void SimplifiedLowering::DoLoadElement(Node* node) { |
const ElementAccess& access = ElementAccessOf(node->op()); |
- node->set_op(machine()->Load(access.machine_type)); |
node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); |
+ NodeProperties::ChangeOp(node, machine()->Load(access.machine_type)); |
} |
void SimplifiedLowering::DoStoreElement(Node* node) { |
const ElementAccess& access = ElementAccessOf(node->op()); |
Type* type = NodeProperties::GetType(node->InputAt(2)); |
- node->set_op(machine()->Store( |
- StoreRepresentation(access.machine_type, |
- ComputeWriteBarrierKind(access.base_is_tagged, |
- access.machine_type, type)))); |
node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); |
+ NodeProperties::ChangeOp( |
+ node, machine()->Store(StoreRepresentation( |
+ access.machine_type, |
+ ComputeWriteBarrierKind(access.base_is_tagged, |
+ access.machine_type, type)))); |
} |
@@ -1610,34 +1617,34 @@ Node* SimplifiedLowering::Uint32Mod(Node* const node) { |
void SimplifiedLowering::DoShift(Node* node, Operator const* op) { |
- node->set_op(op); |
Node* const rhs = NodeProperties::GetValueInput(node, 1); |
Type* const rhs_type = NodeProperties::GetType(rhs); |
if (!rhs_type->Is(zero_thirtyone_range_)) { |
node->ReplaceInput(1, graph()->NewNode(machine()->Word32And(), rhs, |
jsgraph()->Int32Constant(0x1f))); |
} |
+ NodeProperties::ChangeOp(node, op); |
} |
void SimplifiedLowering::DoStringEqual(Node* node) { |
- node->set_op(machine()->WordEqual()); |
node->ReplaceInput(0, StringComparison(node)); |
node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
+ NodeProperties::ChangeOp(node, machine()->WordEqual()); |
} |
void SimplifiedLowering::DoStringLessThan(Node* node) { |
- node->set_op(machine()->IntLessThan()); |
node->ReplaceInput(0, StringComparison(node)); |
node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
+ NodeProperties::ChangeOp(node, machine()->IntLessThan()); |
} |
void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { |
- node->set_op(machine()->IntLessThanOrEqual()); |
node->ReplaceInput(0, StringComparison(node)); |
node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
+ NodeProperties::ChangeOp(node, machine()->IntLessThanOrEqual()); |
} |
} // namespace compiler |