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 2292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2303 } | 2303 } |
2304 | 2304 |
2305 | 2305 |
2306 Definition* UnboxedIntConverterInstr::Canonicalize(FlowGraph* flow_graph) { | 2306 Definition* UnboxedIntConverterInstr::Canonicalize(FlowGraph* flow_graph) { |
2307 if (!HasUses()) return NULL; | 2307 if (!HasUses()) return NULL; |
2308 | 2308 |
2309 UnboxedIntConverterInstr* box_defn = | 2309 UnboxedIntConverterInstr* box_defn = |
2310 value()->definition()->AsUnboxedIntConverter(); | 2310 value()->definition()->AsUnboxedIntConverter(); |
2311 if ((box_defn != NULL) && (box_defn->representation() == from())) { | 2311 if ((box_defn != NULL) && (box_defn->representation() == from())) { |
2312 if (box_defn->from() == to()) { | 2312 if (box_defn->from() == to()) { |
| 2313 // Do not erase truncating convertions from 64-bit value to 32-bit values |
| 2314 // because such convertions erase upper 32 bits. |
| 2315 if ((box_defn->from() == kUnboxedMint) && box_defn->is_truncating()) { |
| 2316 return this; |
| 2317 } |
2313 return box_defn->value()->definition(); | 2318 return box_defn->value()->definition(); |
2314 } | 2319 } |
2315 | 2320 |
2316 UnboxedIntConverterInstr* converter = new UnboxedIntConverterInstr( | 2321 UnboxedIntConverterInstr* converter = new UnboxedIntConverterInstr( |
2317 box_defn->from(), representation(), box_defn->value()->CopyWithType(), | 2322 box_defn->from(), representation(), box_defn->value()->CopyWithType(), |
2318 (to() == kUnboxedInt32) ? GetDeoptId() : Thread::kNoDeoptId); | 2323 (to() == kUnboxedInt32) ? GetDeoptId() : Thread::kNoDeoptId); |
2319 if ((representation() == kUnboxedInt32) && is_truncating()) { | 2324 if ((representation() == kUnboxedInt32) && is_truncating()) { |
2320 converter->mark_truncating(); | 2325 converter->mark_truncating(); |
2321 } | 2326 } |
2322 flow_graph->InsertBefore(this, converter, env(), FlowGraph::kValue); | 2327 flow_graph->InsertBefore(this, converter, env(), FlowGraph::kValue); |
(...skipping 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3986 set_native_c_function(native_function); | 3991 set_native_c_function(native_function); |
3987 function().SetIsNativeAutoSetupScope(auto_setup_scope); | 3992 function().SetIsNativeAutoSetupScope(auto_setup_scope); |
3988 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); | 3993 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); |
3989 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); | 3994 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); |
3990 set_is_bootstrap_native(is_bootstrap_native); | 3995 set_is_bootstrap_native(is_bootstrap_native); |
3991 } | 3996 } |
3992 | 3997 |
3993 #undef __ | 3998 #undef __ |
3994 | 3999 |
3995 } // namespace dart | 4000 } // namespace dart |
OLD | NEW |