Index: src/compiler/js-call-reducer.cc |
diff --git a/src/compiler/js-call-reducer.cc b/src/compiler/js-call-reducer.cc |
index 69a1925b0a20bd85011b31c1fc006051715bb58e..79fd6f6d3862d405ef90330c4526bcb957027fb4 100644 |
--- a/src/compiler/js-call-reducer.cc |
+++ b/src/compiler/js-call-reducer.cc |
@@ -949,27 +949,22 @@ Reduction JSCallReducer::ReduceJSCall(Node* node) { |
if (!p.feedback().IsValid()) return NoChange(); |
CallICNexus nexus(p.feedback().vector(), p.feedback().slot()); |
if (nexus.IsUninitialized()) { |
- // TODO(turbofan): Tail-calling to a CallIC stub is not supported. |
- if (p.tail_call_mode() == TailCallMode::kAllow) return NoChange(); |
- |
- // Insert a CallIC here to collect feedback for uninitialized calls. |
- int const arg_count = static_cast<int>(p.arity() - 2); |
- Callable callable = CodeFactory::CallIC(isolate(), p.convert_mode()); |
- CallDescriptor::Flags flags = CallDescriptor::kNeedsFrameState; |
- CallDescriptor const* const desc = Linkage::GetStubCallDescriptor( |
- isolate(), graph()->zone(), callable.descriptor(), arg_count + 1, |
- flags); |
- Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
- Node* stub_arity = jsgraph()->Constant(arg_count); |
- Node* slot_index = |
- jsgraph()->Constant(FeedbackVector::GetIndex(p.feedback().slot())); |
- Node* feedback_vector = jsgraph()->HeapConstant(p.feedback().vector()); |
- node->InsertInput(graph()->zone(), 0, stub_code); |
- node->InsertInput(graph()->zone(), 2, stub_arity); |
- node->InsertInput(graph()->zone(), 3, slot_index); |
- node->InsertInput(graph()->zone(), 4, feedback_vector); |
- NodeProperties::ChangeOp(node, common()->Call(desc)); |
- return Changed(node); |
+ if (flags() & kBailoutOnUninitialized) { |
+ // Introduce a SOFT deopt if the call {node} wasn't executed so far. |
+ Node* frame_state = NodeProperties::FindFrameStateBefore(node); |
+ Node* deoptimize = graph()->NewNode( |
+ common()->Deoptimize( |
+ DeoptimizeKind::kSoft, |
+ DeoptimizeReason::kInsufficientTypeFeedbackForCall), |
+ frame_state, effect, control); |
+ // TODO(bmeurer): This should be on the AdvancedReducer somehow. |
+ NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); |
+ Revisit(graph()->end()); |
+ node->TrimInputCount(0); |
+ NodeProperties::ChangeOp(node, common()->Dead()); |
+ return Changed(node); |
+ } |
+ return NoChange(); |
} |
Handle<Object> feedback(nexus.GetFeedback(), isolate()); |