| 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/cpu.h" | 8 #include "vm/cpu.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/flow_graph_allocator.h" | 10 #include "vm/flow_graph_allocator.h" |
| (...skipping 2033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2044 } else { | 2044 } else { |
| 2045 UnboxedIntConverterInstr* converter = new UnboxedIntConverterInstr( | 2045 UnboxedIntConverterInstr* converter = new UnboxedIntConverterInstr( |
| 2046 box_defn->value()->definition()->representation(), | 2046 box_defn->value()->definition()->representation(), |
| 2047 representation(), | 2047 representation(), |
| 2048 box_defn->value()->CopyWithType(), | 2048 box_defn->value()->CopyWithType(), |
| 2049 (representation() == kUnboxedInt32) ? | 2049 (representation() == kUnboxedInt32) ? |
| 2050 GetDeoptId() : Isolate::kNoDeoptId); | 2050 GetDeoptId() : Isolate::kNoDeoptId); |
| 2051 if ((representation() == kUnboxedInt32) && !CanDeoptimize()) { | 2051 if ((representation() == kUnboxedInt32) && !CanDeoptimize()) { |
| 2052 converter->mark_truncating(); | 2052 converter->mark_truncating(); |
| 2053 } | 2053 } |
| 2054 flow_graph->InsertBefore(this, converter, env(), FlowGraph::kValue); | 2054 // Only replace if the replacement has CanDeoptimize is consistent with |
| 2055 return converter; | 2055 // the original instructions. We may have removed environments already. |
| 2056 // Due to the way type propagation works currently, the CompileType of the |
| 2057 // converter input may not be the same (more general) than the information |
| 2058 // about the input of this unboxing instructions. |
| 2059 if (CanDeoptimize() == converter->CanDeoptimize()) { |
| 2060 flow_graph->InsertBefore(this, converter, env(), FlowGraph::kValue); |
| 2061 return converter; |
| 2062 } |
| 2056 } | 2063 } |
| 2057 } | 2064 } |
| 2058 | 2065 |
| 2059 return this; | 2066 return this; |
| 2060 } | 2067 } |
| 2061 | 2068 |
| 2062 | 2069 |
| 2063 Definition* UnboxInt32Instr::Canonicalize(FlowGraph* flow_graph) { | 2070 Definition* UnboxInt32Instr::Canonicalize(FlowGraph* flow_graph) { |
| 2064 Definition* replacement = UnboxIntegerInstr::Canonicalize(flow_graph); | 2071 Definition* replacement = UnboxIntegerInstr::Canonicalize(flow_graph); |
| 2065 if (replacement != this) { | 2072 if (replacement != this) { |
| (...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3369 case Token::kTRUNCDIV: return 0; | 3376 case Token::kTRUNCDIV: return 0; |
| 3370 case Token::kMOD: return 1; | 3377 case Token::kMOD: return 1; |
| 3371 default: UNIMPLEMENTED(); return -1; | 3378 default: UNIMPLEMENTED(); return -1; |
| 3372 } | 3379 } |
| 3373 } | 3380 } |
| 3374 | 3381 |
| 3375 | 3382 |
| 3376 #undef __ | 3383 #undef __ |
| 3377 | 3384 |
| 3378 } // namespace dart | 3385 } // namespace dart |
| OLD | NEW |