Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/compiler.h" | 5 #include "vm/compiler.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 | 8 |
| 9 #include "vm/ast_printer.h" | 9 #include "vm/ast_printer.h" |
| 10 #include "vm/block_scheduler.h" | 10 #include "vm/block_scheduler.h" |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 isolate); | 351 isolate); |
| 352 | 352 |
| 353 FlowGraphOptimizer optimizer(flow_graph); | 353 FlowGraphOptimizer optimizer(flow_graph); |
| 354 optimizer.ApplyICData(); | 354 optimizer.ApplyICData(); |
| 355 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 355 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
| 356 | 356 |
| 357 // Optimize (a << b) & c patterns, merge operations. Must occur before | 357 // Optimize (a << b) & c patterns, merge operations. Must occur before |
| 358 // 'SelectRepresentations' which inserts conversion nodes. | 358 // 'SelectRepresentations' which inserts conversion nodes. |
| 359 // TODO(srdjan): Moved before inlining until environment use list can | 359 // TODO(srdjan): Moved before inlining until environment use list can |
| 360 // be used to detect when shift-left is outside the scope of bit-and. | 360 // be used to detect when shift-left is outside the scope of bit-and. |
| 361 optimizer.TryOptimizePatterns(); | 361 optimizer.TryOptimizePatterns(); |
|
Florian Schneider
2013/12/03 14:12:04
Is it necessary to run this twice, here and below?
srdjan
2013/12/03 18:10:01
The one below, after CSE is important. I will elim
srdjan
2013/12/03 21:01:39
Correction: the early one is needed to mark left s
| |
| 362 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 362 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
| 363 | 363 |
| 364 // Inlining (mutates the flow graph) | 364 // Inlining (mutates the flow graph) |
| 365 if (FLAG_use_inlining) { | 365 if (FLAG_use_inlining) { |
| 366 TimerScope timer(FLAG_compiler_stats, | 366 TimerScope timer(FLAG_compiler_stats, |
| 367 &CompilerStats::graphinliner_timer); | 367 &CompilerStats::graphinliner_timer); |
| 368 // Propagate types to create more inlining opportunities. | 368 // Propagate types to create more inlining opportunities. |
| 369 FlowGraphTypePropagator::Propagate(flow_graph); | 369 FlowGraphTypePropagator::Propagate(flow_graph); |
| 370 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 370 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
| 371 | 371 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 433 if (FLAG_common_subexpression_elimination) { | 433 if (FLAG_common_subexpression_elimination) { |
| 434 if (DominatorBasedCSE::Optimize(flow_graph)) { | 434 if (DominatorBasedCSE::Optimize(flow_graph)) { |
| 435 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 435 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
| 436 // Do another round of CSE to take secondary effects into account: | 436 // Do another round of CSE to take secondary effects into account: |
| 437 // e.g. when eliminating dependent loads (a.x[0] + a.x[0]) | 437 // e.g. when eliminating dependent loads (a.x[0] + a.x[0]) |
| 438 // TODO(fschneider): Change to a one-pass optimization pass. | 438 // TODO(fschneider): Change to a one-pass optimization pass. |
| 439 DominatorBasedCSE::Optimize(flow_graph); | 439 DominatorBasedCSE::Optimize(flow_graph); |
| 440 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 440 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
| 441 } | 441 } |
| 442 } | 442 } |
| 443 optimizer.TryOptimizePatterns(); | |
| 444 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | |
| 445 | |
| 443 if (FLAG_loop_invariant_code_motion && | 446 if (FLAG_loop_invariant_code_motion && |
| 444 (function.deoptimization_counter() < | 447 (function.deoptimization_counter() < |
| 445 FLAG_deoptimization_counter_licm_threshold)) { | 448 FLAG_deoptimization_counter_licm_threshold)) { |
| 446 LICM licm(flow_graph); | 449 LICM licm(flow_graph); |
| 447 licm.Optimize(); | 450 licm.Optimize(); |
| 448 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 451 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
| 449 } | 452 } |
| 450 flow_graph->RemoveRedefinitions(); | 453 flow_graph->RemoveRedefinitions(); |
| 451 | 454 |
| 452 if (FLAG_range_analysis) { | 455 if (FLAG_range_analysis) { |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 952 Object::Handle(isolate->object_store()->sticky_error()); | 955 Object::Handle(isolate->object_store()->sticky_error()); |
| 953 isolate->object_store()->clear_sticky_error(); | 956 isolate->object_store()->clear_sticky_error(); |
| 954 isolate->set_long_jump_base(base); | 957 isolate->set_long_jump_base(base); |
| 955 return result.raw(); | 958 return result.raw(); |
| 956 } | 959 } |
| 957 UNREACHABLE(); | 960 UNREACHABLE(); |
| 958 return Object::null(); | 961 return Object::null(); |
| 959 } | 962 } |
| 960 | 963 |
| 961 } // namespace dart | 964 } // namespace dart |
| OLD | NEW |