| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/redundancy_elimination.h" | 5 #include "vm/redundancy_elimination.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/flow_graph.h" | 8 #include "vm/flow_graph.h" |
| 9 #include "vm/hash_map.h" | 9 #include "vm/hash_map.h" |
| 10 #include "vm/il_printer.h" | 10 #include "vm/il_printer.h" |
| 11 #include "vm/intermediate_language.h" | 11 #include "vm/intermediate_language.h" |
| 12 #include "vm/stack_frame.h" | 12 #include "vm/stack_frame.h" |
| 13 | 13 |
| 14 namespace dart { | 14 namespace dart { |
| 15 | 15 |
| 16 | 16 |
| 17 DEFINE_FLAG(bool, dead_store_elimination, true, "Eliminate dead stores"); | 17 DEFINE_FLAG(bool, dead_store_elimination, true, "Eliminate dead stores"); |
| 18 DEFINE_FLAG(bool, load_cse, true, "Use redundant load elimination."); | 18 DEFINE_FLAG(bool, load_cse, true, "Use redundant load elimination."); |
| 19 DEFINE_FLAG(bool, trace_load_optimization, false, | 19 DEFINE_FLAG(bool, trace_load_optimization, false, |
| 20 "Print live sets for load optimization pass."); | 20 "Print live sets for load optimization pass."); |
| 21 | 21 |
| 22 DECLARE_FLAG(bool, fields_may_be_reset); |
| 23 DECLARE_FLAG(bool, precompilation); |
| 24 |
| 22 // Quick access to the current zone. | 25 // Quick access to the current zone. |
| 23 #define Z (zone()) | 26 #define Z (zone()) |
| 24 | 27 |
| 25 | 28 |
| 26 class CSEInstructionMap : public ValueObject { | 29 class CSEInstructionMap : public ValueObject { |
| 27 public: | 30 public: |
| 28 // Right now CSE and LICM track a single effect: possible externalization of | 31 // Right now CSE and LICM track a single effect: possible externalization of |
| 29 // strings. | 32 // strings. |
| 30 // Other effects like modifications of fields are tracked in a separate load | 33 // Other effects like modifications of fields are tracked in a separate load |
| 31 // forwarding pass via Alias structure. | 34 // forwarding pass via Alias structure. |
| (...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1420 | 1423 |
| 1421 // Replace value we are checking with phi's input. | 1424 // Replace value we are checking with phi's input. |
| 1422 check->value()->BindTo(phi->InputAt(non_smi_input)->definition()); | 1425 check->value()->BindTo(phi->InputAt(non_smi_input)->definition()); |
| 1423 | 1426 |
| 1424 phi->UpdateType(CompileType::FromCid(kSmiCid)); | 1427 phi->UpdateType(CompileType::FromCid(kSmiCid)); |
| 1425 } | 1428 } |
| 1426 | 1429 |
| 1427 | 1430 |
| 1428 void LICM::OptimisticallySpecializeSmiPhis() { | 1431 void LICM::OptimisticallySpecializeSmiPhis() { |
| 1429 if (!flow_graph()->function().allows_hoisting_check_class() || | 1432 if (!flow_graph()->function().allows_hoisting_check_class() || |
| 1430 FLAG_precompiled_mode) { | 1433 FLAG_precompilation) { |
| 1431 // Do not hoist any: Either deoptimized on a hoisted check, | 1434 // Do not hoist any: Either deoptimized on a hoisted check, |
| 1432 // or compiling precompiled code where we can't do optimistic | 1435 // or compiling precompiled code where we can't do optimistic |
| 1433 // hoisting of checks. | 1436 // hoisting of checks. |
| 1434 return; | 1437 return; |
| 1435 } | 1438 } |
| 1436 | 1439 |
| 1437 const ZoneGrowableArray<BlockEntryInstr*>& loop_headers = | 1440 const ZoneGrowableArray<BlockEntryInstr*>& loop_headers = |
| 1438 flow_graph()->LoopHeaders(); | 1441 flow_graph()->LoopHeaders(); |
| 1439 | 1442 |
| 1440 for (intptr_t i = 0; i < loop_headers.length(); ++i) { | 1443 for (intptr_t i = 0; i < loop_headers.length(); ++i) { |
| (...skipping 2017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3458 join->phis_ = NULL; | 3461 join->phis_ = NULL; |
| 3459 } else { | 3462 } else { |
| 3460 join->phis_->TruncateTo(to_index); | 3463 join->phis_->TruncateTo(to_index); |
| 3461 } | 3464 } |
| 3462 } | 3465 } |
| 3463 } | 3466 } |
| 3464 } | 3467 } |
| 3465 | 3468 |
| 3466 | 3469 |
| 3467 } // namespace dart | 3470 } // namespace dart |
| OLD | NEW |