diff options
Diffstat (limited to 'deps/v8/src/compiler/js-intrinsic-lowering.cc')
-rw-r--r-- | deps/v8/src/compiler/js-intrinsic-lowering.cc | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/deps/v8/src/compiler/js-intrinsic-lowering.cc b/deps/v8/src/compiler/js-intrinsic-lowering.cc index e82ac205cc..219a452a7d 100644 --- a/deps/v8/src/compiler/js-intrinsic-lowering.cc +++ b/deps/v8/src/compiler/js-intrinsic-lowering.cc @@ -11,6 +11,8 @@ #include "src/compiler/node-matchers.h" #include "src/compiler/node-properties.h" #include "src/compiler/operator-properties.h" +#include "src/counters.h" +#include "src/objects-inl.h" namespace v8 { namespace internal { @@ -52,8 +54,6 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) { return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE); case Runtime::kInlineIsFunction: return ReduceIsInstanceType(node, JS_FUNCTION_TYPE); - case Runtime::kInlineIsNonNegativeSmi: - return ReduceIsNonNegativeSmi(node); case Runtime::kInlineIsRegExp: return ReduceIsInstanceType(node, JS_REGEXP_TYPE); case Runtime::kInlineIsSmi: @@ -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); } @@ -177,11 +177,11 @@ Reduction JSIntrinsicLowering::ReduceHeapObjectGetMap(Node* node) { Reduction JSIntrinsicLowering::ReduceIncrementStatsCounter(Node* node) { if (!FLAG_native_code_counters) return ChangeToUndefined(node); HeapObjectMatcher m(NodeProperties::GetValueInput(node, 0)); - if (!m.HasValue() || !m.Value().handle()->IsString()) { + if (!m.HasValue() || !m.Value()->IsString()) { return ChangeToUndefined(node); } base::SmartArrayPointer<char> name = - Handle<String>::cast(m.Value().handle())->ToCString(); + Handle<String>::cast(m.Value())->ToCString(); StatsCounter counter(jsgraph()->isolate(), name.get()); if (!counter.Enabled()) return ChangeToUndefined(node); @@ -239,11 +239,6 @@ Reduction JSIntrinsicLowering::ReduceIsInstanceType( } -Reduction JSIntrinsicLowering::ReduceIsNonNegativeSmi(Node* node) { - return Change(node, simplified()->ObjectIsNonNegativeSmi()); -} - - Reduction JSIntrinsicLowering::ReduceIsSmi(Node* node) { return Change(node, simplified()->ObjectIsSmi()); } @@ -288,12 +283,13 @@ 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))); + RelaxControls(node); node->ReplaceInput(2, effect); node->ReplaceInput(3, control); node->TrimInputCount(4); - RelaxControls(node); + NodeProperties::ChangeOp( + node, + simplified()->LoadElement(AccessBuilder::ForSeqStringChar(encoding))); return Changed(node); } @@ -306,16 +302,17 @@ 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))); + ReplaceWithValue(node, string, node); + NodeProperties::RemoveType(node); node->ReplaceInput(0, string); node->ReplaceInput(1, index); node->ReplaceInput(2, chr); node->ReplaceInput(3, effect); node->ReplaceInput(4, control); node->TrimInputCount(5); - NodeProperties::RemoveBounds(node); - ReplaceWithValue(node, string, node); + NodeProperties::ChangeOp( + node, + simplified()->StoreElement(AccessBuilder::ForSeqStringChar(encoding))); return Changed(node); } @@ -342,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)); } } } @@ -422,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); } @@ -524,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); } @@ -539,50 +536,52 @@ 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); + RelaxControls(node); node->ReplaceInput(0, a); node->ReplaceInput(1, b); node->TrimInputCount(2); - RelaxControls(node); + NodeProperties::ChangeOp(node, op); return Changed(node); } Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a, Node* b, Node* c) { - node->set_op(op); + RelaxControls(node); node->ReplaceInput(0, a); node->ReplaceInput(1, b); node->ReplaceInput(2, c); node->TrimInputCount(3); - RelaxControls(node); + NodeProperties::ChangeOp(node, op); return Changed(node); } Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a, Node* b, Node* c, Node* d) { - node->set_op(op); + RelaxControls(node); node->ReplaceInput(0, a); node->ReplaceInput(1, b); node->ReplaceInput(2, c); node->ReplaceInput(3, d); node->TrimInputCount(4); - RelaxControls(node); + NodeProperties::ChangeOp(node, op); return Changed(node); } |