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/flow_graph.h" | 5 #include "vm/flow_graph.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/cha.h" | 8 #include "vm/cha.h" |
9 #include "vm/flow_graph_builder.h" | 9 #include "vm/flow_graph_builder.h" |
10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 name.ToCString(), cls.ToCString()); | 461 name.ToCString(), cls.ToCString()); |
462 } | 462 } |
463 thread()->cha()->AddToGuardedClasses(cls, subclass_count); | 463 thread()->cha()->AddToGuardedClasses(cls, subclass_count); |
464 return false; | 464 return false; |
465 } | 465 } |
466 } | 466 } |
467 return true; | 467 return true; |
468 } | 468 } |
469 | 469 |
470 | 470 |
| 471 Instruction* FlowGraph::CreateCheckClass(Definition* to_check, |
| 472 const Cids& cids, |
| 473 intptr_t deopt_id, |
| 474 TokenPosition token_pos) { |
| 475 if (cids.IsMonomorphic() && cids.MonomorphicReceiverCid() == kSmiCid) { |
| 476 return new (zone()) |
| 477 CheckSmiInstr(new (zone()) Value(to_check), deopt_id, token_pos); |
| 478 } |
| 479 return new (zone()) |
| 480 CheckClassInstr(new (zone()) Value(to_check), deopt_id, cids, token_pos); |
| 481 } |
| 482 |
| 483 |
471 bool FlowGraph::VerifyUseLists() { | 484 bool FlowGraph::VerifyUseLists() { |
472 // Verify the initial definitions. | 485 // Verify the initial definitions. |
473 for (intptr_t i = 0; i < graph_entry_->initial_definitions()->length(); ++i) { | 486 for (intptr_t i = 0; i < graph_entry_->initial_definitions()->length(); ++i) { |
474 VerifyUseListsInInstruction((*graph_entry_->initial_definitions())[i]); | 487 VerifyUseListsInInstruction((*graph_entry_->initial_definitions())[i]); |
475 } | 488 } |
476 | 489 |
477 // Verify phis in join entries and the instructions in each block. | 490 // Verify phis in join entries and the instructions in each block. |
478 for (intptr_t i = 0; i < preorder_.length(); ++i) { | 491 for (intptr_t i = 0; i < preorder_.length(); ++i) { |
479 BlockEntryInstr* entry = preorder_[i]; | 492 BlockEntryInstr* entry = preorder_[i]; |
480 JoinEntryInstr* join = entry->AsJoinEntry(); | 493 JoinEntryInstr* join = entry->AsJoinEntry(); |
(...skipping 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2299 Representation rep, | 2312 Representation rep, |
2300 intptr_t cid) { | 2313 intptr_t cid) { |
2301 ExtractNthOutputInstr* extract = | 2314 ExtractNthOutputInstr* extract = |
2302 new (Z) ExtractNthOutputInstr(new (Z) Value(instr), index, rep, cid); | 2315 new (Z) ExtractNthOutputInstr(new (Z) Value(instr), index, rep, cid); |
2303 instr->ReplaceUsesWith(extract); | 2316 instr->ReplaceUsesWith(extract); |
2304 InsertAfter(instr, extract, NULL, FlowGraph::kValue); | 2317 InsertAfter(instr, extract, NULL, FlowGraph::kValue); |
2305 } | 2318 } |
2306 | 2319 |
2307 | 2320 |
2308 } // namespace dart | 2321 } // namespace dart |
OLD | NEW |