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

Side by Side Diff: src/compiler/js-inlining-heuristic.cc

Issue 2026513003: [turbofan] Hook up construct call counts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/js-inlining-heuristic.h" 5 #include "src/compiler/js-inlining-heuristic.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/objects-inl.h" 9 #include "src/objects-inl.h"
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // Stop inlinining once the maximum allowed level is reached. 68 // Stop inlinining once the maximum allowed level is reached.
69 int level = 0; 69 int level = 0;
70 for (Node* frame_state = NodeProperties::GetFrameStateInput(node, 0); 70 for (Node* frame_state = NodeProperties::GetFrameStateInput(node, 0);
71 frame_state->opcode() == IrOpcode::kFrameState; 71 frame_state->opcode() == IrOpcode::kFrameState;
72 frame_state = NodeProperties::GetFrameStateInput(frame_state, 0)) { 72 frame_state = NodeProperties::GetFrameStateInput(frame_state, 0)) {
73 if (++level > FLAG_max_inlining_levels) return NoChange(); 73 if (++level > FLAG_max_inlining_levels) return NoChange();
74 } 74 }
75 75
76 // Gather feedback on how often this call site has been hit before. 76 // Gather feedback on how often this call site has been hit before.
77 int calls = -1; // Same default as CallICNexus::ExtractCallCount. 77 int calls = -1; // Same default as CallICNexus::ExtractCallCount.
78 // TODO(turbofan): We also want call counts for constructor calls.
79 if (node->opcode() == IrOpcode::kJSCallFunction) { 78 if (node->opcode() == IrOpcode::kJSCallFunction) {
80 CallFunctionParameters p = CallFunctionParametersOf(node->op()); 79 CallFunctionParameters p = CallFunctionParametersOf(node->op());
81 if (p.feedback().IsValid()) { 80 if (p.feedback().IsValid()) {
82 CallICNexus nexus(p.feedback().vector(), p.feedback().slot()); 81 CallICNexus nexus(p.feedback().vector(), p.feedback().slot());
83 calls = nexus.ExtractCallCount(); 82 calls = nexus.ExtractCallCount();
84 } 83 }
84 } else {
85 DCHECK_EQ(IrOpcode::kJSCallConstruct, node->opcode());
86 CallConstructParameters p = CallConstructParametersOf(node->op());
87 if (p.feedback().IsValid()) {
88 int const extra_index =
89 p.feedback().vector()->GetIndex(p.feedback().slot()) + 1;
90 Handle<Object> feedback_extra(p.feedback().vector()->get(extra_index),
91 function->GetIsolate());
92 if (feedback_extra->IsSmi()) {
93 calls = Handle<Smi>::cast(feedback_extra)->value();
94 }
95 }
85 } 96 }
86 97
87 // --------------------------------------------------------------------------- 98 // ---------------------------------------------------------------------------
88 // Everything above this line is part of the inlining heuristic. 99 // Everything above this line is part of the inlining heuristic.
89 // --------------------------------------------------------------------------- 100 // ---------------------------------------------------------------------------
90 101
91 // In the general case we remember the candidate for later. 102 // In the general case we remember the candidate for later.
92 candidates_.insert({function, node, calls}); 103 candidates_.insert({function, node, calls});
93 return NoChange(); 104 return NoChange();
94 } 105 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 candidate.node->id(), candidate.calls, 146 candidate.node->id(), candidate.calls,
136 candidate.function->shared()->SourceSize(), 147 candidate.function->shared()->SourceSize(),
137 candidate.function->shared()->ast_node_count(), 148 candidate.function->shared()->ast_node_count(),
138 candidate.function->shared()->DebugName()->ToCString().get()); 149 candidate.function->shared()->DebugName()->ToCString().get());
139 } 150 }
140 } 151 }
141 152
142 } // namespace compiler 153 } // namespace compiler
143 } // namespace internal 154 } // namespace internal
144 } // namespace v8 155 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698