| OLD | NEW |
| 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 #ifndef DART_PRECOMPILED_RUNTIME | 4 #ifndef DART_PRECOMPILED_RUNTIME |
| 5 #include "vm/jit_optimizer.h" | 5 #include "vm/jit_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/branch_optimizer.h" | 8 #include "vm/branch_optimizer.h" |
| 9 #include "vm/cha.h" | 9 #include "vm/cha.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // Optimize instance calls using cid. This is called after optimizer | 55 // Optimize instance calls using cid. This is called after optimizer |
| 56 // converted instance calls to instructions. Any remaining | 56 // converted instance calls to instructions. Any remaining |
| 57 // instance calls are either megamorphic calls, cannot be optimized or | 57 // instance calls are either megamorphic calls, cannot be optimized or |
| 58 // have no runtime type feedback collected. | 58 // have no runtime type feedback collected. |
| 59 // Attempts to convert an instance call (IC call) using propagated class-ids, | 59 // Attempts to convert an instance call (IC call) using propagated class-ids, |
| 60 // e.g., receiver class id, guarded-cid, or by guessing cid-s. | 60 // e.g., receiver class id, guarded-cid, or by guessing cid-s. |
| 61 void JitOptimizer::ApplyClassIds() { | 61 void JitOptimizer::ApplyClassIds() { |
| 62 ASSERT(current_iterator_ == NULL); | 62 ASSERT(current_iterator_ == NULL); |
| 63 for (BlockIterator block_it = flow_graph_->reverse_postorder_iterator(); | 63 for (BlockIterator block_it = flow_graph_->reverse_postorder_iterator(); |
| 64 !block_it.Done(); block_it.Advance()) { | 64 !block_it.Done(); block_it.Advance()) { |
| 65 thread()->CheckForSafepoint(); |
| 65 ForwardInstructionIterator it(block_it.Current()); | 66 ForwardInstructionIterator it(block_it.Current()); |
| 66 current_iterator_ = ⁢ | 67 current_iterator_ = ⁢ |
| 67 for (; !it.Done(); it.Advance()) { | 68 for (; !it.Done(); it.Advance()) { |
| 68 Instruction* instr = it.Current(); | 69 Instruction* instr = it.Current(); |
| 69 if (instr->IsInstanceCall()) { | 70 if (instr->IsInstanceCall()) { |
| 70 InstanceCallInstr* call = instr->AsInstanceCall(); | 71 InstanceCallInstr* call = instr->AsInstanceCall(); |
| 71 if (call->HasICData()) { | 72 if (call->HasICData()) { |
| 72 if (TryCreateICData(call)) { | 73 if (TryCreateICData(call)) { |
| 73 VisitInstanceCall(call); | 74 VisitInstanceCall(call); |
| 74 } | 75 } |
| (...skipping 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1869 // Discard the environment from the original instruction because the store | 1870 // Discard the environment from the original instruction because the store |
| 1870 // can't deoptimize. | 1871 // can't deoptimize. |
| 1871 instr->RemoveEnvironment(); | 1872 instr->RemoveEnvironment(); |
| 1872 ReplaceCall(instr, store); | 1873 ReplaceCall(instr, store); |
| 1873 return true; | 1874 return true; |
| 1874 } | 1875 } |
| 1875 | 1876 |
| 1876 | 1877 |
| 1877 } // namespace dart | 1878 } // namespace dart |
| 1878 #endif // DART_PRECOMPILED_RUNTIME | 1879 #endif // DART_PRECOMPILED_RUNTIME |
| OLD | NEW |