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

Side by Side Diff: runtime/vm/flow_graph_compiler.cc

Issue 1410733006: More general CHA-based inlining and devirtualization for precompiled code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX.
6 6
7 #include "vm/flow_graph_compiler.h" 7 #include "vm/flow_graph_compiler.h"
8 8
9 #include "vm/bit_vector.h" 9 #include "vm/bit_vector.h"
10 #include "vm/cha.h" 10 #include "vm/cha.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) { 245 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) {
246 Instruction* current = it.Current(); 246 Instruction* current = it.Current();
247 if (current->IsBranch()) { 247 if (current->IsBranch()) {
248 current = current->AsBranch()->comparison(); 248 current = current->AsBranch()->comparison();
249 } 249 }
250 // In optimized code, ICData is always set in the instructions. 250 // In optimized code, ICData is always set in the instructions.
251 const ICData* ic_data = NULL; 251 const ICData* ic_data = NULL;
252 if (current->IsInstanceCall()) { 252 if (current->IsInstanceCall()) {
253 ic_data = current->AsInstanceCall()->ic_data(); 253 ic_data = current->AsInstanceCall()->ic_data();
254 } 254 }
255 if ((ic_data != NULL) && (ic_data->NumberOfUsedChecks() == 0)) { 255 if ((ic_data == NULL) ||
256 ((ic_data != NULL) && (ic_data->NumberOfUsedChecks() == 0))) {
srdjan 2015/10/21 17:37:46 When do you see ic_data NULL, except for precompil
Florian Schneider 2015/10/22 13:59:25 Same here. Defensive left over check.
256 may_reoptimize_ = true; 257 may_reoptimize_ = true;
rmacnak 2015/10/21 18:00:30 Can we rename this to has_ic_calls_ or, probably b
Florian Schneider 2015/10/22 13:59:25 may_reoptimize_ has no effect with precompilation
257 } 258 }
258 if (is_leaf && 259 if (is_leaf &&
259 !current->IsCheckStackOverflow() && 260 !current->IsCheckStackOverflow() &&
260 !current->IsParallelMove()) { 261 !current->IsParallelMove()) {
261 // Note that we do not care if the code contains instructions that 262 // Note that we do not care if the code contains instructions that
262 // can deoptimize. 263 // can deoptimize.
263 LocationSummary* locs = current->locs(); 264 LocationSummary* locs = current->locs();
264 if ((locs != NULL) && locs->can_call()) { 265 if ((locs != NULL) && locs->can_call()) {
265 is_leaf = false; 266 is_leaf = false;
266 } 267 }
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 const ICData& ic_data) { 1091 const ICData& ic_data) {
1091 if (FLAG_always_megamorphic_calls) { 1092 if (FLAG_always_megamorphic_calls) {
1092 EmitMegamorphicInstanceCall(ic_data, argument_count, 1093 EmitMegamorphicInstanceCall(ic_data, argument_count,
1093 deopt_id, token_pos, locs); 1094 deopt_id, token_pos, locs);
1094 return; 1095 return;
1095 } 1096 }
1096 ASSERT(!ic_data.IsNull()); 1097 ASSERT(!ic_data.IsNull());
1097 if (is_optimizing() && (ic_data.NumberOfUsedChecks() == 0)) { 1098 if (is_optimizing() && (ic_data.NumberOfUsedChecks() == 0)) {
1098 // Emit IC call that will count and thus may need reoptimization at 1099 // Emit IC call that will count and thus may need reoptimization at
1099 // function entry. 1100 // function entry.
1100 ASSERT(!is_optimizing() 1101 ASSERT(may_reoptimize() || flow_graph().IsCompiledForOsr());
1101 || may_reoptimize()
1102 || flow_graph().IsCompiledForOsr());
1103 switch (ic_data.NumArgsTested()) { 1102 switch (ic_data.NumArgsTested()) {
1104 case 1: 1103 case 1:
1105 EmitOptimizedInstanceCall( 1104 EmitOptimizedInstanceCall(
1106 *StubCode::OneArgOptimizedCheckInlineCache_entry(), ic_data, 1105 *StubCode::OneArgOptimizedCheckInlineCache_entry(), ic_data,
1107 argument_count, deopt_id, token_pos, locs); 1106 argument_count, deopt_id, token_pos, locs);
1108 return; 1107 return;
1109 case 2: 1108 case 2:
1110 EmitOptimizedInstanceCall( 1109 EmitOptimizedInstanceCall(
1111 *StubCode::TwoArgsOptimizedCheckInlineCache_entry(), ic_data, 1110 *StubCode::TwoArgsOptimizedCheckInlineCache_entry(), ic_data,
1112 argument_count, deopt_id, token_pos, locs); 1111 argument_count, deopt_id, token_pos, locs);
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
1816 1815
1817 1816
1818 void FlowGraphCompiler::FrameStateClear() { 1817 void FlowGraphCompiler::FrameStateClear() {
1819 ASSERT(!is_optimizing()); 1818 ASSERT(!is_optimizing());
1820 frame_state_.TruncateTo(0); 1819 frame_state_.TruncateTo(0);
1821 } 1820 }
1822 #endif 1821 #endif
1823 1822
1824 1823
1825 } // namespace dart 1824 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698