Index: src/compiler/js-call-reducer.cc |
diff --git a/src/compiler/js-call-reducer.cc b/src/compiler/js-call-reducer.cc |
index 79fd6f6d3862d405ef90330c4526bcb957027fb4..af0c3da7a0812aa37a0a4bcc46b4610638d835d0 100644 |
--- a/src/compiler/js-call-reducer.cc |
+++ b/src/compiler/js-call-reducer.cc |
@@ -951,18 +951,8 @@ Reduction JSCallReducer::ReduceJSCall(Node* node) { |
if (nexus.IsUninitialized()) { |
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 ReduceSoftDeoptimize( |
+ node, DeoptimizeReason::kInsufficientTypeFeedbackForCall); |
} |
return NoChange(); |
} |
@@ -1083,8 +1073,18 @@ Reduction JSCallReducer::ReduceJSConstruct(Node* node) { |
return NoChange(); |
} |
+ // Extract feedback from the {node} using the CallICNexus. |
if (!p.feedback().IsValid()) return NoChange(); |
CallICNexus nexus(p.feedback().vector(), p.feedback().slot()); |
+ if (nexus.IsUninitialized()) { |
+ if (flags() & kBailoutOnUninitialized) { |
+ // Introduce a SOFT deopt if the construct {node} wasn't executed so far. |
+ return ReduceSoftDeoptimize( |
+ node, DeoptimizeReason::kInsufficientTypeFeedbackForConstruct); |
+ } |
+ return NoChange(); |
+ } |
+ |
Handle<Object> feedback(nexus.GetFeedback(), isolate()); |
if (feedback->IsAllocationSite()) { |
// The feedback is an AllocationSite, which means we have called the |
@@ -1167,6 +1167,22 @@ Reduction JSCallReducer::ReduceReturnReceiver(Node* node) { |
return Replace(receiver); |
} |
+Reduction JSCallReducer::ReduceSoftDeoptimize(Node* node, |
+ DeoptimizeReason reason) { |
+ Node* effect = NodeProperties::GetEffectInput(node); |
+ Node* control = NodeProperties::GetControlInput(node); |
+ Node* frame_state = NodeProperties::FindFrameStateBefore(node); |
+ Node* deoptimize = |
+ graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kSoft, reason), |
+ 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); |
+} |
+ |
Graph* JSCallReducer::graph() const { return jsgraph()->graph(); } |
Isolate* JSCallReducer::isolate() const { return jsgraph()->isolate(); } |