| 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/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 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1309 | 1309 |
| 1310 Instruction* CheckClassInstr::Canonicalize(FlowGraphOptimizer* optimizer) { | 1310 Instruction* CheckClassInstr::Canonicalize(FlowGraphOptimizer* optimizer) { |
| 1311 // TODO(vegorov): Replace class checks with null checks when ToNullableCid | 1311 // TODO(vegorov): Replace class checks with null checks when ToNullableCid |
| 1312 // matches. | 1312 // matches. |
| 1313 | 1313 |
| 1314 const intptr_t value_cid = value()->Type()->ToCid(); | 1314 const intptr_t value_cid = value()->Type()->ToCid(); |
| 1315 if (value_cid == kDynamicCid) { | 1315 if (value_cid == kDynamicCid) { |
| 1316 return this; | 1316 return this; |
| 1317 } | 1317 } |
| 1318 | 1318 |
| 1319 const intptr_t num_checks = unary_checks().NumberOfChecks(); | 1319 return unary_checks().HasReceiverClassId(value_cid) ? NULL : this; |
| 1320 | |
| 1321 for (intptr_t i = 0; i < num_checks; i++) { | |
| 1322 if (value_cid == unary_checks().GetReceiverClassIdAt(i)) { | |
| 1323 // No checks needed. | |
| 1324 return NULL; | |
| 1325 } | |
| 1326 } | |
| 1327 | |
| 1328 return this; | |
| 1329 } | 1320 } |
| 1330 | 1321 |
| 1331 | 1322 |
| 1332 Instruction* GuardFieldInstr::Canonicalize(FlowGraphOptimizer* optimizer) { | 1323 Instruction* GuardFieldInstr::Canonicalize(FlowGraphOptimizer* optimizer) { |
| 1333 if (field().guarded_cid() == kDynamicCid) { | 1324 if (field().guarded_cid() == kDynamicCid) { |
| 1334 return NULL; // Nothing to guard. | 1325 return NULL; // Nothing to guard. |
| 1335 } | 1326 } |
| 1336 | 1327 |
| 1337 if (field().is_nullable() && value()->Type()->IsNull()) { | 1328 if (field().is_nullable() && value()->Type()->IsNull()) { |
| 1338 return NULL; | 1329 return NULL; |
| (...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2388 default: | 2379 default: |
| 2389 UNREACHABLE(); | 2380 UNREACHABLE(); |
| 2390 } | 2381 } |
| 2391 return kPowRuntimeEntry; | 2382 return kPowRuntimeEntry; |
| 2392 } | 2383 } |
| 2393 | 2384 |
| 2394 | 2385 |
| 2395 #undef __ | 2386 #undef __ |
| 2396 | 2387 |
| 2397 } // namespace dart | 2388 } // namespace dart |
| OLD | NEW |