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

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

Issue 860963002: Refactor _ByteDataView.[set|get]* methods to improve their performance. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 | Annotate | Revision Log
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/flow_graph_inliner.h" 5 #include "vm/flow_graph_inliner.h"
6 6
7 #include "vm/block_scheduler.h" 7 #include "vm/block_scheduler.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/flow_graph.h" 10 #include "vm/flow_graph.h"
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 490
491 FlowGraph* caller_graph() const { return caller_graph_; } 491 FlowGraph* caller_graph() const { return caller_graph_; }
492 492
493 Isolate* isolate() const { return caller_graph_->isolate(); } 493 Isolate* isolate() const { return caller_graph_->isolate(); }
494 494
495 // Inlining heuristics based on Cooper et al. 2008. 495 // Inlining heuristics based on Cooper et al. 2008.
496 bool ShouldWeInline(const Function& callee, 496 bool ShouldWeInline(const Function& callee,
497 intptr_t instr_count, 497 intptr_t instr_count,
498 intptr_t call_site_count, 498 intptr_t call_site_count,
499 intptr_t const_arg_count) { 499 intptr_t const_arg_count) {
500 if (FlowGraphInliner::AlwaysInline(callee)) {
501 return true;
502 }
500 if (inlined_size_ > FLAG_inlining_caller_size_threshold) { 503 if (inlined_size_ > FLAG_inlining_caller_size_threshold) {
501 // Prevent methods becoming humongous and thus slow to compile. 504 // Prevent methods becoming humongous and thus slow to compile.
502 return false; 505 return false;
503 } 506 }
504 if (const_arg_count > 0) { 507 if (const_arg_count > 0) {
505 if (instr_count > FLAG_inlining_constant_arguments_max_size_threshold) { 508 if (instr_count > FLAG_inlining_constant_arguments_max_size_threshold) {
506 return false; 509 return false;
507 } 510 }
508 } else if (instr_count > FLAG_inlining_callee_size_threshold) { 511 } else if (instr_count > FLAG_inlining_callee_size_threshold) {
509 return false; 512 return false;
510 } 513 }
511 // 'instr_count' can be 0 if it was not computed yet. 514 // 'instr_count' can be 0 if it was not computed yet.
512 if ((instr_count != 0) && (instr_count <= FLAG_inlining_size_threshold)) { 515 if ((instr_count != 0) && (instr_count <= FLAG_inlining_size_threshold)) {
513 return true; 516 return true;
514 } 517 }
515 if (call_site_count <= FLAG_inlining_callee_call_sites_threshold) { 518 if (call_site_count <= FLAG_inlining_callee_call_sites_threshold) {
516 return true; 519 return true;
517 } 520 }
518 if ((const_arg_count >= FLAG_inlining_constant_arguments_count) && 521 if ((const_arg_count >= FLAG_inlining_constant_arguments_count) &&
519 (instr_count <= FLAG_inlining_constant_arguments_min_size_threshold)) { 522 (instr_count <= FLAG_inlining_constant_arguments_min_size_threshold)) {
520 return true; 523 return true;
521 } 524 }
522 if (FlowGraphInliner::AlwaysInline(callee)) {
523 return true;
524 }
525 return false; 525 return false;
526 } 526 }
527 527
528 void InlineCalls() { 528 void InlineCalls() {
529 // If inlining depth is less then one abort. 529 // If inlining depth is less then one abort.
530 if (FLAG_inlining_depth_threshold < 1) return; 530 if (FLAG_inlining_depth_threshold < 1) return;
531 if (caller_graph_->parsed_function()->function().deoptimization_counter() >= 531 if (caller_graph_->parsed_function()->function().deoptimization_counter() >=
532 FLAG_deoptimization_counter_inlining_threshold) { 532 FLAG_deoptimization_counter_inlining_threshold) {
533 return; 533 return;
534 } 534 }
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1815 1815
1816 1816
1817 intptr_t FlowGraphInliner::NextInlineId(const Function& function) { 1817 intptr_t FlowGraphInliner::NextInlineId(const Function& function) {
1818 const intptr_t id = inline_id_to_function_->length(); 1818 const intptr_t id = inline_id_to_function_->length();
1819 inline_id_to_function_->Add(&function); 1819 inline_id_to_function_->Add(&function);
1820 return id; 1820 return id;
1821 } 1821 }
1822 1822
1823 1823
1824 } // namespace dart 1824 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698