Index: src/compiler/js-inlining-heuristic.cc |
diff --git a/src/compiler/js-inlining-heuristic.cc b/src/compiler/js-inlining-heuristic.cc |
index 0e0508bcd4ccd64f600280580ab002dde1162d6c..0118b92446a8462cda8915c1039a31222ffc73d8 100644 |
--- a/src/compiler/js-inlining-heuristic.cc |
+++ b/src/compiler/js-inlining-heuristic.cc |
@@ -75,13 +75,24 @@ Reduction JSInliningHeuristic::Reduce(Node* node) { |
// Gather feedback on how often this call site has been hit before. |
int calls = -1; // Same default as CallICNexus::ExtractCallCount. |
- // TODO(turbofan): We also want call counts for constructor calls. |
if (node->opcode() == IrOpcode::kJSCallFunction) { |
CallFunctionParameters p = CallFunctionParametersOf(node->op()); |
if (p.feedback().IsValid()) { |
CallICNexus nexus(p.feedback().vector(), p.feedback().slot()); |
calls = nexus.ExtractCallCount(); |
} |
+ } else { |
+ DCHECK_EQ(IrOpcode::kJSCallConstruct, node->opcode()); |
+ CallConstructParameters p = CallConstructParametersOf(node->op()); |
+ if (p.feedback().IsValid()) { |
+ int const extra_index = |
+ p.feedback().vector()->GetIndex(p.feedback().slot()) + 1; |
+ Handle<Object> feedback_extra(p.feedback().vector()->get(extra_index), |
+ function->GetIsolate()); |
+ if (feedback_extra->IsSmi()) { |
+ calls = Handle<Smi>::cast(feedback_extra)->value(); |
+ } |
+ } |
} |
// --------------------------------------------------------------------------- |