| 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/constant_propagator.h" | 8 #include "vm/constant_propagator.h" |
| 9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 3243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3254 // Leave the CreateArrayInstr and StoreIndexedInstr in the stream in case | 3254 // Leave the CreateArrayInstr and StoreIndexedInstr in the stream in case |
| 3255 // deoptimization occurs. | 3255 // deoptimization occurs. |
| 3256 Definition* StringInterpolateInstr::Canonicalize(FlowGraph* flow_graph) { | 3256 Definition* StringInterpolateInstr::Canonicalize(FlowGraph* flow_graph) { |
| 3257 // The following graph structure is generated by the graph builder: | 3257 // The following graph structure is generated by the graph builder: |
| 3258 // v2 <- CreateArray(v0) | 3258 // v2 <- CreateArray(v0) |
| 3259 // StoreIndexed(v2, v3, v4) -- v3:constant index, v4: value. | 3259 // StoreIndexed(v2, v3, v4) -- v3:constant index, v4: value. |
| 3260 // .. | 3260 // .. |
| 3261 // v8 <- StringInterpolate(v2) | 3261 // v8 <- StringInterpolate(v2) |
| 3262 | 3262 |
| 3263 // Don't compile-time fold when optimizing the interpolation function itself. | 3263 // Don't compile-time fold when optimizing the interpolation function itself. |
| 3264 if (flow_graph->parsed_function()->function().raw() == CallFunction().raw()) { | 3264 if (flow_graph->function().raw() == CallFunction().raw()) { |
| 3265 return this; | 3265 return this; |
| 3266 } | 3266 } |
| 3267 | 3267 |
| 3268 CreateArrayInstr* create_array = value()->definition()->AsCreateArray(); | 3268 CreateArrayInstr* create_array = value()->definition()->AsCreateArray(); |
| 3269 ASSERT(create_array != NULL); | 3269 ASSERT(create_array != NULL); |
| 3270 // Check if the string interpolation has only constant inputs. | 3270 // Check if the string interpolation has only constant inputs. |
| 3271 Value* num_elements = create_array->num_elements(); | 3271 Value* num_elements = create_array->num_elements(); |
| 3272 if (!num_elements->BindsToConstant() || | 3272 if (!num_elements->BindsToConstant() || |
| 3273 !num_elements->BoundConstant().IsSmi()) { | 3273 !num_elements->BoundConstant().IsSmi()) { |
| 3274 return this; | 3274 return this; |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3490 case Token::kTRUNCDIV: return 0; | 3490 case Token::kTRUNCDIV: return 0; |
| 3491 case Token::kMOD: return 1; | 3491 case Token::kMOD: return 1; |
| 3492 default: UNIMPLEMENTED(); return -1; | 3492 default: UNIMPLEMENTED(); return -1; |
| 3493 } | 3493 } |
| 3494 } | 3494 } |
| 3495 | 3495 |
| 3496 | 3496 |
| 3497 #undef __ | 3497 #undef __ |
| 3498 | 3498 |
| 3499 } // namespace dart | 3499 } // namespace dart |
| OLD | NEW |