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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/bootstrap.h" | 8 #include "vm/bootstrap.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/constant_propagator.h" | 10 #include "vm/constant_propagator.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 ASSERT(IsDenseSwitch()); | 269 ASSERT(IsDenseSwitch()); |
270 intptr_t mask = 0; | 270 intptr_t mask = 0; |
271 for (intptr_t i = 0; i < cids_.length(); ++i) { | 271 for (intptr_t i = 0; i < cids_.length(); ++i) { |
272 mask |= static_cast<intptr_t>(1) << (cids_[i] - cids_[0]); | 272 mask |= static_cast<intptr_t>(1) << (cids_[i] - cids_[0]); |
273 } | 273 } |
274 return mask; | 274 return mask; |
275 } | 275 } |
276 | 276 |
277 | 277 |
278 bool CheckClassInstr::IsDenseMask(intptr_t mask) { | 278 bool CheckClassInstr::IsDenseMask(intptr_t mask) { |
279 // Returns true if the mask is a continuos sequence of ones in its binary | 279 // Returns true if the mask is a continuous sequence of ones in its binary |
280 // representation (i.e. no holes) | 280 // representation (i.e. no holes) |
281 return mask == -1 || Utils::IsPowerOfTwo(mask + 1); | 281 return mask == -1 || Utils::IsPowerOfTwo(mask + 1); |
282 } | 282 } |
283 | 283 |
284 | 284 |
285 bool LoadFieldInstr::IsUnboxedLoad() const { | 285 bool LoadFieldInstr::IsUnboxedLoad() const { |
286 return FLAG_unbox_numeric_fields && (field() != NULL) && | 286 return FLAG_unbox_numeric_fields && (field() != NULL) && |
287 FlowGraphCompiler::IsUnboxedField(*field()); | 287 FlowGraphCompiler::IsUnboxedField(*field()); |
288 } | 288 } |
289 | 289 |
(...skipping 2017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2307 } | 2307 } |
2308 | 2308 |
2309 | 2309 |
2310 Definition* UnboxedIntConverterInstr::Canonicalize(FlowGraph* flow_graph) { | 2310 Definition* UnboxedIntConverterInstr::Canonicalize(FlowGraph* flow_graph) { |
2311 if (!HasUses()) return NULL; | 2311 if (!HasUses()) return NULL; |
2312 | 2312 |
2313 UnboxedIntConverterInstr* box_defn = | 2313 UnboxedIntConverterInstr* box_defn = |
2314 value()->definition()->AsUnboxedIntConverter(); | 2314 value()->definition()->AsUnboxedIntConverter(); |
2315 if ((box_defn != NULL) && (box_defn->representation() == from())) { | 2315 if ((box_defn != NULL) && (box_defn->representation() == from())) { |
2316 if (box_defn->from() == to()) { | 2316 if (box_defn->from() == to()) { |
2317 // Do not erase truncating convertions from 64-bit value to 32-bit values | 2317 // Do not erase truncating conversions from 64-bit value to 32-bit values |
2318 // because such convertions erase upper 32 bits. | 2318 // because such conversions erase upper 32 bits. |
2319 if ((box_defn->from() == kUnboxedMint) && box_defn->is_truncating()) { | 2319 if ((box_defn->from() == kUnboxedMint) && box_defn->is_truncating()) { |
2320 return this; | 2320 return this; |
2321 } | 2321 } |
2322 return box_defn->value()->definition(); | 2322 return box_defn->value()->definition(); |
2323 } | 2323 } |
2324 | 2324 |
2325 UnboxedIntConverterInstr* converter = new UnboxedIntConverterInstr( | 2325 UnboxedIntConverterInstr* converter = new UnboxedIntConverterInstr( |
2326 box_defn->from(), representation(), box_defn->value()->CopyWithType(), | 2326 box_defn->from(), representation(), box_defn->value()->CopyWithType(), |
2327 (to() == kUnboxedInt32) ? GetDeoptId() : Thread::kNoDeoptId); | 2327 (to() == kUnboxedInt32) ? GetDeoptId() : Thread::kNoDeoptId); |
2328 if ((representation() == kUnboxedInt32) && is_truncating()) { | 2328 if ((representation() == kUnboxedInt32) && is_truncating()) { |
(...skipping 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4183 "native function '%s' (%" Pd " arguments) cannot be found", | 4183 "native function '%s' (%" Pd " arguments) cannot be found", |
4184 native_name().ToCString(), function().NumParameters()); | 4184 native_name().ToCString(), function().NumParameters()); |
4185 } | 4185 } |
4186 set_is_auto_scope(auto_setup_scope); | 4186 set_is_auto_scope(auto_setup_scope); |
4187 set_native_c_function(native_function); | 4187 set_native_c_function(native_function); |
4188 } | 4188 } |
4189 | 4189 |
4190 #undef __ | 4190 #undef __ |
4191 | 4191 |
4192 } // namespace dart | 4192 } // namespace dart |
OLD | NEW |