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

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

Issue 1657153002: Clean up global variables related to precompilation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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) 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/compiler.h"
9 #include "vm/il_printer.h" 9 #include "vm/il_printer.h"
10 10
11 namespace dart { 11 namespace dart {
12 12
13 DEFINE_FLAG(bool, array_bounds_check_elimination, true, 13 DEFINE_FLAG(bool, array_bounds_check_elimination, true,
14 "Eliminate redundant bounds checks."); 14 "Eliminate redundant bounds checks.");
15 DEFINE_FLAG(bool, trace_range_analysis, false, "Trace range analysis progress"); 15 DEFINE_FLAG(bool, trace_range_analysis, false, "Trace range analysis progress");
16 DEFINE_FLAG(bool, trace_integer_ir_selection, false, 16 DEFINE_FLAG(bool, trace_integer_ir_selection, false,
17 "Print integer IR selection optimization pass."); 17 "Print integer IR selection optimization pass.");
18 DECLARE_FLAG(bool, precompilation);
18 DECLARE_FLAG(bool, trace_constant_propagation); 19 DECLARE_FLAG(bool, trace_constant_propagation);
19 20
20 // Quick access to the locally defined isolate() and zone() methods. 21 // Quick access to the locally defined isolate() and zone() methods.
21 #define I (isolate()) 22 #define I (isolate())
22 #define Z (zone()) 23 #define Z (zone())
23 24
24 void RangeAnalysis::Analyze() { 25 void RangeAnalysis::Analyze() {
25 CollectValues(); 26 CollectValues();
26 InsertConstraints(); 27 InsertConstraints();
27 DiscoverSimpleInductionVariables(); 28 DiscoverSimpleInductionVariables();
(...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after
1527 1528
1528 1529
1529 void RangeAnalysis::EliminateRedundantBoundsChecks() { 1530 void RangeAnalysis::EliminateRedundantBoundsChecks() {
1530 if (FLAG_array_bounds_check_elimination) { 1531 if (FLAG_array_bounds_check_elimination) {
1531 const Function& function = flow_graph_->function(); 1532 const Function& function = flow_graph_->function();
1532 // Generalization only if we have not deoptimized on a generalized 1533 // Generalization only if we have not deoptimized on a generalized
1533 // check earlier, or we're compiling precompiled code (no 1534 // check earlier, or we're compiling precompiled code (no
1534 // optimistic hoisting of checks possible) 1535 // optimistic hoisting of checks possible)
1535 const bool try_generalization = 1536 const bool try_generalization =
1536 function.allows_bounds_check_generalization() && 1537 function.allows_bounds_check_generalization() &&
1537 !Compiler::always_optimize(); 1538 !FLAG_precompilation;
1538 1539
1539 BoundsCheckGeneralizer generalizer(this, flow_graph_); 1540 BoundsCheckGeneralizer generalizer(this, flow_graph_);
1540 1541
1541 for (intptr_t i = 0; i < bounds_checks_.length(); i++) { 1542 for (intptr_t i = 0; i < bounds_checks_.length(); i++) {
1542 CheckArrayBoundInstr* check = bounds_checks_[i]; 1543 CheckArrayBoundInstr* check = bounds_checks_[i];
1543 RangeBoundary array_length = 1544 RangeBoundary array_length =
1544 RangeBoundary::FromDefinition(check->length()->definition()); 1545 RangeBoundary::FromDefinition(check->length()->definition());
1545 if (check->IsRedundant(array_length)) { 1546 if (check->IsRedundant(array_length)) {
1546 check->RemoveFromGraph(); 1547 check->RemoveFromGraph();
1547 } else if (try_generalization) { 1548 } else if (try_generalization) {
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after
3158 } 3159 }
3159 } while (CanonicalizeMaxBoundary(&max) || 3160 } while (CanonicalizeMaxBoundary(&max) ||
3160 CanonicalizeMinBoundary(&canonical_length)); 3161 CanonicalizeMinBoundary(&canonical_length));
3161 3162
3162 // Failed to prove that maximum is bounded with array length. 3163 // Failed to prove that maximum is bounded with array length.
3163 return false; 3164 return false;
3164 } 3165 }
3165 3166
3166 3167
3167 } // namespace dart 3168 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698