| 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 | 4 |
| 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. |
| 6 | 6 |
| 7 #include "vm/flow_graph_compiler.h" | 7 #include "vm/flow_graph_compiler.h" |
| 8 | 8 |
| 9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
| 10 #include "vm/cha.h" | 10 #include "vm/cha.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 // Returns true if OnebyteString is a frequent receiver class. We inline | 155 // Returns true if OnebyteString is a frequent receiver class. We inline |
| 156 // Smi check as well, since a Smi check must be done anyway. | 156 // Smi check as well, since a Smi check must be done anyway. |
| 157 // TODO(srdjan): Add check and code if Smi class is hot. | 157 // TODO(srdjan): Add check and code if Smi class is hot. |
| 158 bool FlowGraphCompiler::ShouldInlineSmiStringHashCode(const ICData& ic_data) { | 158 bool FlowGraphCompiler::ShouldInlineSmiStringHashCode(const ICData& ic_data) { |
| 159 if (!FLAG_inline_smi_string_hashcode || | 159 if (!FLAG_inline_smi_string_hashcode || |
| 160 (ic_data.target_name() != Symbols::hashCode().raw())) { | 160 (ic_data.target_name() != Symbols::hashCode().raw())) { |
| 161 return false; | 161 return false; |
| 162 } | 162 } |
| 163 // Precompiled code has no ICData, optimistically inline it. | 163 // Precompiled code has no ICData, optimistically inline it. |
| 164 if (ic_data.IsNull() || (ic_data.NumberOfChecks() == 0)) { | 164 if (ic_data.IsNull() || ic_data.NumberOfChecksIs(0)) { |
| 165 return true; | 165 return true; |
| 166 } | 166 } |
| 167 // Check if OneByteString is hot enough. | 167 // Check if OneByteString is hot enough. |
| 168 const ICData& ic_data_sorted = | 168 const ICData& ic_data_sorted = |
| 169 ICData::Handle(ic_data.AsUnaryClassChecksSortedByCount()); | 169 ICData::Handle(ic_data.AsUnaryClassChecksSortedByCount()); |
| 170 ASSERT(ic_data_sorted.NumberOfChecks() > 0); | 170 ASSERT(!ic_data_sorted.NumberOfChecksIs(0)); |
| 171 if (ic_data_sorted.GetReceiverClassIdAt(0) == kOneByteStringCid) { | 171 if (ic_data_sorted.GetReceiverClassIdAt(0) == kOneByteStringCid) { |
| 172 const intptr_t total_count = ic_data_sorted.AggregateCount(); | 172 const intptr_t total_count = ic_data_sorted.AggregateCount(); |
| 173 const intptr_t ratio = (ic_data_sorted.GetCountAt(0) * 100) / total_count; | 173 const intptr_t ratio = (ic_data_sorted.GetCountAt(0) * 100) / total_count; |
| 174 return ratio > FLAG_inline_smi_string_hashcode_ratio; | 174 return ratio > FLAG_inline_smi_string_hashcode_ratio; |
| 175 } | 175 } |
| 176 return false; | 176 return false; |
| 177 } | 177 } |
| 178 | 178 |
| 179 | 179 |
| 180 FlowGraphCompiler::FlowGraphCompiler( | 180 FlowGraphCompiler::FlowGraphCompiler( |
| (...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1886 | 1886 |
| 1887 | 1887 |
| 1888 void FlowGraphCompiler::FrameStateClear() { | 1888 void FlowGraphCompiler::FrameStateClear() { |
| 1889 ASSERT(!is_optimizing()); | 1889 ASSERT(!is_optimizing()); |
| 1890 frame_state_.TruncateTo(0); | 1890 frame_state_.TruncateTo(0); |
| 1891 } | 1891 } |
| 1892 #endif // defined(DEBUG) && !defined(TARGET_ARCH_DBC) | 1892 #endif // defined(DEBUG) && !defined(TARGET_ARCH_DBC) |
| 1893 | 1893 |
| 1894 | 1894 |
| 1895 } // namespace dart | 1895 } // namespace dart |
| OLD | NEW |