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

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

Issue 2097413002: Improve inlining of recognized methods in AOT. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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 | runtime/vm/flow_graph_inliner.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/aot_optimizer.h" 5 #include "vm/aot_optimizer.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/branch_optimizer.h" 8 #include "vm/branch_optimizer.h"
9 #include "vm/cha.h" 9 #include "vm/cha.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1624 // Non-implicit getters are inlined like normal methods by conventional 1624 // Non-implicit getters are inlined like normal methods by conventional
1625 // inlining in FlowGraphInliner. 1625 // inlining in FlowGraphInliner.
1626 return false; 1626 return false;
1627 } 1627 }
1628 return InlineImplicitInstanceGetter(call); 1628 return InlineImplicitInstanceGetter(call);
1629 } 1629 }
1630 1630
1631 1631
1632 bool AotOptimizer::TryReplaceInstanceCallWithInline( 1632 bool AotOptimizer::TryReplaceInstanceCallWithInline(
1633 InstanceCallInstr* call) { 1633 InstanceCallInstr* call) {
1634 if (!IsAllowedForInlining(call->deopt_id())) return false;
1634 Function& target = Function::Handle(Z); 1635 Function& target = Function::Handle(Z);
1635 GrowableArray<intptr_t> class_ids; 1636 GrowableArray<intptr_t> class_ids;
1636 call->ic_data()->GetCheckAt(0, &class_ids, &target); 1637 call->ic_data()->GetCheckAt(0, &class_ids, &target);
1637 const intptr_t receiver_cid = class_ids[0]; 1638 const intptr_t receiver_cid = class_ids[0];
1638 1639
1639 TargetEntryInstr* entry; 1640 TargetEntryInstr* entry;
1640 Definition* last; 1641 Definition* last;
1641 if (!FlowGraphInliner::TryInlineRecognizedMethod(flow_graph_, 1642 if (!FlowGraphInliner::TryInlineRecognizedMethod(flow_graph_,
1642 receiver_cid, 1643 receiver_cid,
1643 target, 1644 target,
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
2340 } 2341 }
2341 2342
2342 if (Token::IsBinaryOperator(op_kind) && 2343 if (Token::IsBinaryOperator(op_kind) &&
2343 TryReplaceWithBinaryOp(instr, op_kind)) { 2344 TryReplaceWithBinaryOp(instr, op_kind)) {
2344 return; 2345 return;
2345 } 2346 }
2346 if (Token::IsUnaryOperator(op_kind) && 2347 if (Token::IsUnaryOperator(op_kind) &&
2347 TryReplaceWithUnaryOp(instr, op_kind)) { 2348 TryReplaceWithUnaryOp(instr, op_kind)) {
2348 return; 2349 return;
2349 } 2350 }
2351
2352 if (TryInlineInstanceMethod(instr)) {
2353 return;
2354 }
2350 } 2355 }
2351 2356
2352 bool has_one_target = 2357 bool has_one_target =
2353 (unary_checks.NumberOfChecks() > 0) && unary_checks.HasOneTarget(); 2358 (unary_checks.NumberOfChecks() > 0) && unary_checks.HasOneTarget();
2354 if (has_one_target) { 2359 if (has_one_target) {
2355 // Check if the single target is a polymorphic target, if it is, 2360 // Check if the single target is a polymorphic target, if it is,
2356 // we don't have one target. 2361 // we don't have one target.
2357 const Function& target = 2362 const Function& target =
2358 Function::Handle(Z, unary_checks.GetTargetAt(0)); 2363 Function::Handle(Z, unary_checks.GetTargetAt(0));
2359 const bool polymorphic_target = MethodRecognizer::PolymorphicTarget(target); 2364 const bool polymorphic_target = MethodRecognizer::PolymorphicTarget(target);
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
2778 2783
2779 // Discard the environment from the original instruction because the store 2784 // Discard the environment from the original instruction because the store
2780 // can't deoptimize. 2785 // can't deoptimize.
2781 instr->RemoveEnvironment(); 2786 instr->RemoveEnvironment();
2782 ReplaceCall(instr, store); 2787 ReplaceCall(instr, store);
2783 return true; 2788 return true;
2784 } 2789 }
2785 2790
2786 2791
2787 } // namespace dart 2792 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_inliner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698