| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/flow_graph_allocator.h" | 9 #include "vm/flow_graph_allocator.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| (...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 RawAbstractType* CheckSmiInstr::CompileType() const { | 1118 RawAbstractType* CheckSmiInstr::CompileType() const { |
| 1119 return AbstractType::null(); | 1119 return AbstractType::null(); |
| 1120 } | 1120 } |
| 1121 | 1121 |
| 1122 | 1122 |
| 1123 RawAbstractType* CheckArrayBoundInstr::CompileType() const { | 1123 RawAbstractType* CheckArrayBoundInstr::CompileType() const { |
| 1124 return AbstractType::null(); | 1124 return AbstractType::null(); |
| 1125 } | 1125 } |
| 1126 | 1126 |
| 1127 | 1127 |
| 1128 RawAbstractType* CheckBoundInstr::CompileType() const { |
| 1129 return AbstractType::null(); |
| 1130 } |
| 1131 |
| 1132 |
| 1128 RawAbstractType* CheckEitherNonSmiInstr::CompileType() const { | 1133 RawAbstractType* CheckEitherNonSmiInstr::CompileType() const { |
| 1129 return AbstractType::null(); | 1134 return AbstractType::null(); |
| 1130 } | 1135 } |
| 1131 | 1136 |
| 1132 | 1137 |
| 1133 // Optimizations that eliminate or simplify individual computations. | 1138 // Optimizations that eliminate or simplify individual computations. |
| 1134 Definition* Definition::Canonicalize() { | 1139 Definition* Definition::Canonicalize() { |
| 1135 return this; | 1140 return this; |
| 1136 } | 1141 } |
| 1137 | 1142 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 | 1179 |
| 1175 Definition* CheckEitherNonSmiInstr::Canonicalize() { | 1180 Definition* CheckEitherNonSmiInstr::Canonicalize() { |
| 1176 if ((left()->ResultCid() == kDoubleCid) || | 1181 if ((left()->ResultCid() == kDoubleCid) || |
| 1177 (right()->ResultCid() == kDoubleCid)) { | 1182 (right()->ResultCid() == kDoubleCid)) { |
| 1178 return NULL; // Remove from the graph. | 1183 return NULL; // Remove from the graph. |
| 1179 } | 1184 } |
| 1180 return this; | 1185 return this; |
| 1181 } | 1186 } |
| 1182 | 1187 |
| 1183 | 1188 |
| 1189 Definition* CheckArrayBoundInstr::Canonicalize() { |
| 1190 if (array_type() == kArrayCid) { |
| 1191 // For fixed length arrays check if array is the result of a constructor |
| 1192 // call. In this case we can use the length passed to the constructor |
| 1193 // instead of loading it from array itself. |
| 1194 StaticCallInstr* allocation = array()->definition()->AsStaticCall(); |
| 1195 if ((allocation != NULL) && |
| 1196 allocation->is_known_constructor() && |
| 1197 (allocation->ResultCid() == kArrayCid)) { |
| 1198 CheckBoundInstr* check = |
| 1199 new CheckBoundInstr(allocation->ArgumentAt(0)->value()->Copy(), |
| 1200 index(), |
| 1201 deopt_id_); |
| 1202 check->set_env(env()); |
| 1203 set_env(NULL); |
| 1204 return check; |
| 1205 } |
| 1206 } |
| 1207 return this; |
| 1208 } |
| 1209 |
| 1210 |
| 1184 // Shared code generation methods (EmitNativeCode, MakeLocationSummary, and | 1211 // Shared code generation methods (EmitNativeCode, MakeLocationSummary, and |
| 1185 // PrepareEntry). Only assembly code that can be shared across all architectures | 1212 // PrepareEntry). Only assembly code that can be shared across all architectures |
| 1186 // can be used. Machine specific register allocation and code generation | 1213 // can be used. Machine specific register allocation and code generation |
| 1187 // is located in intermediate_language_<arch>.cc | 1214 // is located in intermediate_language_<arch>.cc |
| 1188 | 1215 |
| 1189 #define __ compiler->assembler()-> | 1216 #define __ compiler->assembler()-> |
| 1190 | 1217 |
| 1191 void GraphEntryInstr::PrepareEntry(FlowGraphCompiler* compiler) { | 1218 void GraphEntryInstr::PrepareEntry(FlowGraphCompiler* compiler) { |
| 1192 // Nothing to do. | 1219 // Nothing to do. |
| 1193 } | 1220 } |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1663 value->set_use_index(use_index++); | 1690 value->set_use_index(use_index++); |
| 1664 value->AddToEnvUseList(); | 1691 value->AddToEnvUseList(); |
| 1665 } | 1692 } |
| 1666 instr->set_env(copy); | 1693 instr->set_env(copy); |
| 1667 } | 1694 } |
| 1668 | 1695 |
| 1669 | 1696 |
| 1670 #undef __ | 1697 #undef __ |
| 1671 | 1698 |
| 1672 } // namespace dart | 1699 } // namespace dart |
| OLD | NEW |