Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Unified Diff: src/compiler/js-intrinsic-lowering.cc

Issue 1366753003: [turbofan] Make Node::set_op safer via wrapper. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/js-inlining.cc ('k') | src/compiler/js-typed-lowering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-intrinsic-lowering.cc
diff --git a/src/compiler/js-intrinsic-lowering.cc b/src/compiler/js-intrinsic-lowering.cc
index 1f947169fcab5e0a7212fdad28cf97ccfedc0f23..324c42e9de2a0564102c22d1f10369fe9b1cb350 100644
--- a/src/compiler/js-intrinsic-lowering.cc
+++ b/src/compiler/js-intrinsic-lowering.cc
@@ -149,8 +149,8 @@ Reduction JSIntrinsicLowering::ReduceDeoptimizeNow(Node* node) {
graph()->NewNode(common()->Deoptimize(), frame_state, effect, control);
NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
- node->set_op(common()->Dead());
node->TrimInputCount(0);
+ NodeProperties::ChangeOp(node, common()->Dead());
return Changed(node);
}
@@ -283,11 +283,12 @@ Reduction JSIntrinsicLowering::ReduceSeqStringGetChar(
Node* node, String::Encoding encoding) {
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
- node->set_op(
- simplified()->LoadElement(AccessBuilder::ForSeqStringChar(encoding)));
node->ReplaceInput(2, effect);
node->ReplaceInput(3, control);
node->TrimInputCount(4);
+ NodeProperties::ChangeOp(
+ node,
+ simplified()->LoadElement(AccessBuilder::ForSeqStringChar(encoding)));
RelaxControls(node);
return Changed(node);
}
@@ -301,14 +302,15 @@ Reduction JSIntrinsicLowering::ReduceSeqStringSetChar(
Node* string = NodeProperties::GetValueInput(node, 2);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
- node->set_op(
- simplified()->StoreElement(AccessBuilder::ForSeqStringChar(encoding)));
node->ReplaceInput(0, string);
node->ReplaceInput(1, index);
node->ReplaceInput(2, chr);
node->ReplaceInput(3, effect);
node->ReplaceInput(4, control);
node->TrimInputCount(5);
+ NodeProperties::ChangeOp(
+ node,
+ simplified()->StoreElement(AccessBuilder::ForSeqStringChar(encoding)));
NodeProperties::RemoveType(node);
ReplaceWithValue(node, string, node);
return Changed(node);
@@ -337,7 +339,7 @@ Reduction JSIntrinsicLowering::ReduceUnLikely(Node* node, BranchHint hint) {
nodes_to_visit.push(use);
} else if (use->opcode() == IrOpcode::kBranch) {
// Actually set the hint on any branch using the intrinsic node.
- use->set_op(common()->Branch(hint));
+ NodeProperties::ChangeOp(use, common()->Branch(hint));
}
}
}
@@ -417,7 +419,7 @@ Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op) {
// 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);
return Changed(node);
}
@@ -519,14 +521,14 @@ Reduction JSIntrinsicLowering::ReduceThrowNotDateError(Node* node) {
graph()->NewNode(common()->Deoptimize(), frame_state, effect, control);
NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
- node->set_op(common()->Dead());
node->TrimInputCount(0);
+ NodeProperties::ChangeOp(node, common()->Dead());
return Changed(node);
}
Reduction JSIntrinsicLowering::ReduceToObject(Node* node) {
- node->set_op(javascript()->ToObject());
+ NodeProperties::ChangeOp(node, javascript()->ToObject());
return Changed(node);
}
@@ -534,24 +536,26 @@ Reduction JSIntrinsicLowering::ReduceToObject(Node* node) {
Reduction JSIntrinsicLowering::ReduceCallFunction(Node* node) {
CallRuntimeParameters params = OpParameter<CallRuntimeParameters>(node->op());
size_t arity = params.arity();
- node->set_op(javascript()->CallFunction(arity, NO_CALL_FUNCTION_FLAGS, STRICT,
- VectorSlotPair(), ALLOW_TAIL_CALLS));
Node* function = node->InputAt(static_cast<int>(arity - 1));
while (--arity != 0) {
node->ReplaceInput(static_cast<int>(arity),
node->InputAt(static_cast<int>(arity - 1)));
}
node->ReplaceInput(0, function);
+ NodeProperties::ChangeOp(
+ node,
+ javascript()->CallFunction(params.arity(), NO_CALL_FUNCTION_FLAGS, STRICT,
+ VectorSlotPair(), ALLOW_TAIL_CALLS));
return Changed(node);
}
Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a,
Node* b) {
- node->set_op(op);
node->ReplaceInput(0, a);
node->ReplaceInput(1, b);
node->TrimInputCount(2);
+ NodeProperties::ChangeOp(node, op);
RelaxControls(node);
return Changed(node);
}
@@ -559,11 +563,11 @@ Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a,
Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a,
Node* b, Node* c) {
- node->set_op(op);
node->ReplaceInput(0, a);
node->ReplaceInput(1, b);
node->ReplaceInput(2, c);
node->TrimInputCount(3);
+ NodeProperties::ChangeOp(node, op);
RelaxControls(node);
return Changed(node);
}
@@ -571,12 +575,12 @@ Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a,
Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a,
Node* b, Node* c, Node* d) {
- node->set_op(op);
node->ReplaceInput(0, a);
node->ReplaceInput(1, b);
node->ReplaceInput(2, c);
node->ReplaceInput(3, d);
node->TrimInputCount(4);
+ NodeProperties::ChangeOp(node, op);
RelaxControls(node);
return Changed(node);
}
« no previous file with comments | « src/compiler/js-inlining.cc ('k') | src/compiler/js-typed-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698