| 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 3191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3202 // Leave the CreateArrayInstr and StoreIndexedInstr in the stream in case | 3202 // Leave the CreateArrayInstr and StoreIndexedInstr in the stream in case |
| 3203 // deoptimization occurs. | 3203 // deoptimization occurs. |
| 3204 Definition* StringInterpolateInstr::Canonicalize(FlowGraph* flow_graph) { | 3204 Definition* StringInterpolateInstr::Canonicalize(FlowGraph* flow_graph) { |
| 3205 // The following graph structure is generated by the graph builder: | 3205 // The following graph structure is generated by the graph builder: |
| 3206 // v2 <- CreateArray(v0) | 3206 // v2 <- CreateArray(v0) |
| 3207 // StoreIndexed(v2, v3, v4) -- v3:constant index, v4: value. | 3207 // StoreIndexed(v2, v3, v4) -- v3:constant index, v4: value. |
| 3208 // .. | 3208 // .. |
| 3209 // v8 <- StringInterpolate(v2) | 3209 // v8 <- StringInterpolate(v2) |
| 3210 | 3210 |
| 3211 // Don't compile-time fold when optimizing the interpolation function itself. | 3211 // Don't compile-time fold when optimizing the interpolation function itself. |
| 3212 if (flow_graph->parsed_function().function().raw() == CallFunction().raw()) { | 3212 if (flow_graph->parsed_function()->function().raw() == CallFunction().raw()) { |
| 3213 return this; | 3213 return this; |
| 3214 } | 3214 } |
| 3215 | 3215 |
| 3216 CreateArrayInstr* create_array = value()->definition()->AsCreateArray(); | 3216 CreateArrayInstr* create_array = value()->definition()->AsCreateArray(); |
| 3217 ASSERT(create_array != NULL); | 3217 ASSERT(create_array != NULL); |
| 3218 // Check if the string interpolation has only constant inputs. | 3218 // Check if the string interpolation has only constant inputs. |
| 3219 Value* num_elements = create_array->num_elements(); | 3219 Value* num_elements = create_array->num_elements(); |
| 3220 if (!num_elements->BindsToConstant() || | 3220 if (!num_elements->BindsToConstant() || |
| 3221 !num_elements->BoundConstant().IsSmi()) { | 3221 !num_elements->BoundConstant().IsSmi()) { |
| 3222 return this; | 3222 return this; |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3438 case Token::kTRUNCDIV: return 0; | 3438 case Token::kTRUNCDIV: return 0; |
| 3439 case Token::kMOD: return 1; | 3439 case Token::kMOD: return 1; |
| 3440 default: UNIMPLEMENTED(); return -1; | 3440 default: UNIMPLEMENTED(); return -1; |
| 3441 } | 3441 } |
| 3442 } | 3442 } |
| 3443 | 3443 |
| 3444 | 3444 |
| 3445 #undef __ | 3445 #undef __ |
| 3446 | 3446 |
| 3447 } // namespace dart | 3447 } // namespace dart |
| OLD | NEW |