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

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

Issue 1423063005: VM: Speculative inlining in precompiled code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add retry Created 5 years, 1 month 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_range_analysis.h" 5 #include "vm/flow_graph_range_analysis.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/compiler.h"
8 #include "vm/il_printer.h" 9 #include "vm/il_printer.h"
9 10
10 namespace dart { 11 namespace dart {
11 12
12 DEFINE_FLAG(bool, array_bounds_check_elimination, true, 13 DEFINE_FLAG(bool, array_bounds_check_elimination, true,
13 "Eliminate redundant bounds checks."); 14 "Eliminate redundant bounds checks.");
14 DEFINE_FLAG(bool, trace_range_analysis, false, "Trace range analysis progress"); 15 DEFINE_FLAG(bool, trace_range_analysis, false, "Trace range analysis progress");
15 DEFINE_FLAG(bool, trace_integer_ir_selection, false, 16 DEFINE_FLAG(bool, trace_integer_ir_selection, false,
16 "Print integer IR selection optimization pass."); 17 "Print integer IR selection optimization pass.");
17 DECLARE_FLAG(bool, trace_constant_propagation); 18 DECLARE_FLAG(bool, trace_constant_propagation);
(...skipping 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 RangeAnalysis* range_analysis_; 1523 RangeAnalysis* range_analysis_;
1523 FlowGraph* flow_graph_; 1524 FlowGraph* flow_graph_;
1524 Scheduler scheduler_; 1525 Scheduler scheduler_;
1525 }; 1526 };
1526 1527
1527 1528
1528 void RangeAnalysis::EliminateRedundantBoundsChecks() { 1529 void RangeAnalysis::EliminateRedundantBoundsChecks() {
1529 if (FLAG_array_bounds_check_elimination) { 1530 if (FLAG_array_bounds_check_elimination) {
1530 const Function& function = flow_graph_->function(); 1531 const Function& function = flow_graph_->function();
1531 const bool try_generalization = 1532 const bool try_generalization =
1532 function.allows_bounds_check_generalization(); 1533 function.allows_bounds_check_generalization() &&
1534 !Compiler::always_optimize();
srdjan 2015/11/17 17:35:24 Please add a comment why we should not try_general
Florian Schneider 2015/11/17 19:38:57 Done.
1533 1535
1534 BoundsCheckGeneralizer generalizer(this, flow_graph_); 1536 BoundsCheckGeneralizer generalizer(this, flow_graph_);
1535 1537
1536 for (intptr_t i = 0; i < bounds_checks_.length(); i++) { 1538 for (intptr_t i = 0; i < bounds_checks_.length(); i++) {
1537 CheckArrayBoundInstr* check = bounds_checks_[i]; 1539 CheckArrayBoundInstr* check = bounds_checks_[i];
1538 RangeBoundary array_length = 1540 RangeBoundary array_length =
1539 RangeBoundary::FromDefinition(check->length()->definition()); 1541 RangeBoundary::FromDefinition(check->length()->definition());
1540 if (check->IsRedundant(array_length)) { 1542 if (check->IsRedundant(array_length)) {
1541 check->RemoveFromGraph(); 1543 check->RemoveFromGraph();
1542 } else if (try_generalization) { 1544 } else if (try_generalization) {
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after
3153 } 3155 }
3154 } while (CanonicalizeMaxBoundary(&max) || 3156 } while (CanonicalizeMaxBoundary(&max) ||
3155 CanonicalizeMinBoundary(&canonical_length)); 3157 CanonicalizeMinBoundary(&canonical_length));
3156 3158
3157 // Failed to prove that maximum is bounded with array length. 3159 // Failed to prove that maximum is bounded with array length.
3158 return false; 3160 return false;
3159 } 3161 }
3160 3162
3161 3163
3162 } // namespace dart 3164 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698