Chromium Code Reviews| Index: src/compiler/js-typed-lowering.cc |
| diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc |
| index c5d03d117b8abf57c1e5d2bea8c7127ef06e4742..ae115b1f710a9cae832429e423fabe89e37464de 100644 |
| --- a/src/compiler/js-typed-lowering.cc |
| +++ b/src/compiler/js-typed-lowering.cc |
| @@ -163,7 +163,7 @@ class JSBinopReduction final { |
| // Remove the inputs corresponding to context, effect, and control. |
| NodeProperties::RemoveNonValueInputs(node_); |
| // Finally, update the operator to the new one. |
| - node_->set_op(op); |
| + NodeProperties::ChangeOp(node_, op); |
| // TODO(jarin): Replace the explicit typing hack with a call to some method |
| // that encapsulates changing the operator and re-typing. |
| @@ -362,7 +362,7 @@ class JSBinopReduction final { |
| NodeProperties::RemoveType(exception_merge); |
| exception_merge->ReplaceInput(0, left_exception); |
| exception_merge->ReplaceInput(1, right_exception); |
| - exception_merge->set_op(common()->Merge(2)); |
| + NodeProperties::ChangeOp(exception_merge, common()->Merge(2)); |
| *left_result = left_conv; |
| *right_result = right_conv; |
| @@ -413,7 +413,7 @@ Reduction JSTypedLowering::ReduceJSAdd(Node* node) { |
| node->RemoveInput(NodeProperties::FirstFrameStateIndex(node) + 1); |
| node->InsertInput(graph()->zone(), 0, |
| jsgraph()->HeapConstant(callable.code())); |
| - node->set_op(common()->Call(desc)); |
| + NodeProperties::ChangeOp(node, common()->Call(desc)); |
| return Changed(node); |
| } |
| return NoChange(); |
| @@ -629,12 +629,12 @@ Reduction JSTypedLowering::ReduceJSUnaryNot(Node* node) { |
| Type* const input_type = NodeProperties::GetType(input); |
| if (input_type->Is(Type::Boolean())) { |
| // JSUnaryNot(x:boolean) => BooleanNot(x) |
| - node->set_op(simplified()->BooleanNot()); |
| node->TrimInputCount(1); |
| + NodeProperties::ChangeOp(node, simplified()->BooleanNot()); |
|
Jarin
2015/09/24 14:00:41
After ReplaceInput? (Here and below.)
Michael Starzinger
2015/09/24 14:21:28
Done.
|
| return Changed(node); |
| } else if (input_type->Is(Type::OrderedNumber())) { |
| // JSUnaryNot(x:number) => NumberEqual(x,#0) |
| - node->set_op(simplified()->NumberEqual()); |
| + NodeProperties::ChangeOp(node, simplified()->NumberEqual()); |
| node->ReplaceInput(1, jsgraph()->ZeroConstant()); |
| DCHECK_EQ(2, node->InputCount()); |
| return Changed(node); |
| @@ -645,7 +645,7 @@ Reduction JSTypedLowering::ReduceJSUnaryNot(Node* node) { |
| // chain) because we assume String::length to be immutable. |
| Node* length = graph()->NewNode(simplified()->LoadField(access), input, |
| graph()->start(), graph()->start()); |
| - node->set_op(simplified()->NumberEqual()); |
| + NodeProperties::ChangeOp(node, simplified()->NumberEqual()); |
| node->ReplaceInput(0, length); |
| node->ReplaceInput(1, jsgraph()->ZeroConstant()); |
| ReplaceWithValue(node, node, length); |
| @@ -664,10 +664,10 @@ Reduction JSTypedLowering::ReduceJSToBoolean(Node* node) { |
| return Replace(input); |
| } else if (input_type->Is(Type::OrderedNumber())) { |
| // JSToBoolean(x:ordered-number) => BooleanNot(NumberEqual(x,#0)) |
| - node->set_op(simplified()->BooleanNot()); |
| node->ReplaceInput(0, graph()->NewNode(simplified()->NumberEqual(), input, |
| jsgraph()->ZeroConstant())); |
| node->TrimInputCount(1); |
| + NodeProperties::ChangeOp(node, simplified()->BooleanNot()); |
| return Changed(node); |
| } else if (input_type->Is(Type::String())) { |
| // JSToBoolean(x:string) => NumberLessThan(#0,x.length) |
| @@ -676,7 +676,7 @@ Reduction JSTypedLowering::ReduceJSToBoolean(Node* node) { |
| // chain) because we assume String::length to be immutable. |
| Node* length = graph()->NewNode(simplified()->LoadField(access), input, |
| graph()->start(), graph()->start()); |
| - node->set_op(simplified()->NumberLessThan()); |
| + NodeProperties::ChangeOp(node, simplified()->NumberLessThan()); |
| node->ReplaceInput(0, jsgraph()->ZeroConstant()); |
| node->ReplaceInput(1, length); |
| DCHECK_EQ(2, node->InputCount()); |
| @@ -908,21 +908,22 @@ Reduction JSTypedLowering::ReduceJSStoreProperty(Node* node) { |
| } |
| // Check if we can avoid the bounds check. |
| if (key_type->Min() >= 0 && key_type->Max() < array->length_value()) { |
| - node->set_op(simplified()->StoreElement( |
| - AccessBuilder::ForTypedArrayElement(array->type(), true))); |
| node->ReplaceInput(0, buffer); |
| DCHECK_EQ(key, node->InputAt(1)); |
| node->ReplaceInput(2, value); |
| node->ReplaceInput(3, effect); |
| node->ReplaceInput(4, control); |
| node->TrimInputCount(5); |
| + NodeProperties::ChangeOp( |
| + node, |
| + simplified()->StoreElement( |
| + AccessBuilder::ForTypedArrayElement(array->type(), true))); |
| RelaxControls(node); |
| return Changed(node); |
| } |
| // Compute byte offset. |
| Node* offset = Word32Shl(key, static_cast<int>(k)); |
| // Turn into a StoreBuffer operation. |
| - node->set_op(simplified()->StoreBuffer(access)); |
| node->ReplaceInput(0, buffer); |
| node->ReplaceInput(1, offset); |
| node->ReplaceInput(2, length); |
| @@ -930,6 +931,7 @@ Reduction JSTypedLowering::ReduceJSStoreProperty(Node* node) { |
| node->ReplaceInput(4, effect); |
| node->ReplaceInput(5, control); |
| node->TrimInputCount(6); |
| + NodeProperties::ChangeOp(node, simplified()->StoreBuffer(access)); |
| RelaxControls(node); |
| return Changed(node); |
| } |
| @@ -951,7 +953,8 @@ Reduction JSTypedLowering::ReduceJSLoadContext(Node* node) { |
| AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX)), |
| NodeProperties::GetValueInput(node, 0), effect, control)); |
| } |
| - node->set_op( |
| + NodeProperties::ChangeOp( |
| + node, |
| simplified()->LoadField(AccessBuilder::ForContextSlot(access.index()))); |
| node->ReplaceInput(1, effect); |
| node->ReplaceInput(2, control); |
| @@ -972,9 +975,10 @@ Reduction JSTypedLowering::ReduceJSStoreContext(Node* node) { |
| AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX)), |
| NodeProperties::GetValueInput(node, 0), effect, control)); |
| } |
| - node->set_op( |
| - simplified()->StoreField(AccessBuilder::ForContextSlot(access.index()))); |
| node->RemoveInput(2); |
| + NodeProperties::ChangeOp( |
| + node, |
| + simplified()->StoreField(AccessBuilder::ForContextSlot(access.index()))); |
| DCHECK_EQ(4, node->InputCount()); |
| return Changed(node); |
| } |
| @@ -1007,8 +1011,9 @@ Reduction JSTypedLowering::ReduceJSLoadDynamicGlobal(Node* node) { |
| check_true); |
| Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
| Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
| - check_false->set_op(common()->Merge(check_false->InputCount() + 1)); |
| check_false->AppendInput(graph()->zone(), if_false); |
| + NodeProperties::ChangeOp(check_false, |
| + common()->Merge(check_false->InputCount())); |
| check_true = if_true; |
| } |
| @@ -1066,8 +1071,9 @@ Reduction JSTypedLowering::ReduceJSLoadDynamicContext(Node* node) { |
| check_true); |
| Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
| Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
| - check_false->set_op(common()->Merge(check_false->InputCount() + 1)); |
| check_false->AppendInput(graph()->zone(), if_false); |
| + NodeProperties::ChangeOp(check_false, |
| + common()->Merge(check_false->InputCount())); |
| check_true = if_true; |
| } |
| @@ -1115,7 +1121,7 @@ Reduction JSTypedLowering::ReduceJSCreateClosure(Node* node) { |
| Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
| node->InsertInput(graph()->zone(), 0, stub_code); |
| node->InsertInput(graph()->zone(), 1, jsgraph()->HeapConstant(shared)); |
| - node->set_op(new_op); |
| + NodeProperties::ChangeOp(node, new_op); |
| return Changed(node); |
| } |
| @@ -1145,7 +1151,7 @@ Reduction JSTypedLowering::ReduceJSCreateLiteralArray(Node* node) { |
| const Operator* new_op = common()->Call(desc); |
| Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
| node->InsertInput(graph()->zone(), 0, stub_code); |
| - node->set_op(new_op); |
| + NodeProperties::ChangeOp(node, new_op); |
| return Changed(node); |
| } |
| @@ -1175,7 +1181,7 @@ Reduction JSTypedLowering::ReduceJSCreateLiteralObject(Node* node) { |
| Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
| node->InsertInput(graph()->zone(), 3, jsgraph()->Constant(flags)); |
| node->InsertInput(graph()->zone(), 0, stub_code); |
| - node->set_op(new_op); |
| + NodeProperties::ChangeOp(node, new_op); |
| return Changed(node); |
| } |
| @@ -1209,8 +1215,8 @@ Reduction JSTypedLowering::ReduceJSCreateWithContext(Node* node) { |
| ReplaceWithValue(node, node, a.effect()); |
| node->ReplaceInput(0, a.allocation()); |
| node->ReplaceInput(1, a.effect()); |
| - node->set_op(common()->Finish(1)); |
| node->TrimInputCount(2); |
| + NodeProperties::ChangeOp(node, common()->Finish(1)); |
| return Changed(node); |
| } |
| return NoChange(); |
| @@ -1248,8 +1254,8 @@ Reduction JSTypedLowering::ReduceJSCreateBlockContext(Node* node) { |
| ReplaceWithValue(node, node, a.effect()); |
| node->ReplaceInput(0, a.allocation()); |
| node->ReplaceInput(1, a.effect()); |
| - node->set_op(common()->Finish(1)); |
| node->TrimInputCount(2); |
| + NodeProperties::ChangeOp(node, common()->Finish(1)); |
| return Changed(node); |
| } |
| return NoChange(); |
| @@ -1280,8 +1286,9 @@ Reduction JSTypedLowering::ReduceJSCallFunction(Node* node) { |
| if (is_strict(p.language_mode())) { |
| flags |= CallDescriptor::kSupportsTailCalls; |
| } |
| - node->set_op(common()->Call(Linkage::GetJSCallDescriptor( |
| - graph()->zone(), false, 1 + arity, flags))); |
| + NodeProperties::ChangeOp(node, |
| + common()->Call(Linkage::GetJSCallDescriptor( |
| + graph()->zone(), false, 1 + arity, flags))); |
| return Changed(node); |
| } |
| } |
| @@ -1291,8 +1298,8 @@ Reduction JSTypedLowering::ReduceJSCallFunction(Node* node) { |
| Reduction JSTypedLowering::ReduceJSForInDone(Node* node) { |
| DCHECK_EQ(IrOpcode::kJSForInDone, node->opcode()); |
| - node->set_op(machine()->Word32Equal()); |
| node->TrimInputCount(2); |
| + NodeProperties::ChangeOp(node, machine()->Word32Equal()); |
| return Changed(node); |
| } |
| @@ -1540,19 +1547,19 @@ Reduction JSTypedLowering::ReduceJSForInNext(Node* node) { |
| control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); |
| effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); |
| ReplaceWithValue(node, node, effect, control); |
| - node->set_op(common()->Phi(kMachAnyTagged, 2)); |
| node->ReplaceInput(0, vtrue0); |
| node->ReplaceInput(1, vfalse0); |
| node->ReplaceInput(2, control); |
| node->TrimInputCount(3); |
| + NodeProperties::ChangeOp(node, common()->Phi(kMachAnyTagged, 2)); |
| return Changed(node); |
| } |
| Reduction JSTypedLowering::ReduceJSForInStep(Node* node) { |
| DCHECK_EQ(IrOpcode::kJSForInStep, node->opcode()); |
| - node->set_op(machine()->Int32Add()); |
| node->ReplaceInput(1, jsgraph()->Int32Constant(1)); |
| + NodeProperties::ChangeOp(node, machine()->Int32Add()); |
| DCHECK_EQ(2, node->InputCount()); |
| return Changed(node); |
| } |