Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: vm/intermediate_language.cc

Issue 10665022: Make IL instructions a doubly-linked list within basic blocks. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: use_ssa flag off by default Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« vm/intermediate_language.h ('K') | « vm/intermediate_language.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/flow_graph_builder.h" 8 #include "vm/flow_graph_builder.h"
9 #include "vm/flow_graph_compiler.h" 9 #include "vm/flow_graph_compiler.h"
10 #include "vm/locations.h" 10 #include "vm/locations.h"
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 StraightLineSuccessor()->IsBlockEntry()); 524 StraightLineSuccessor()->IsBlockEntry());
525 return StraightLineSuccessor() != NULL ? 1 : 0; 525 return StraightLineSuccessor() != NULL ? 1 : 0;
526 } 526 }
527 527
528 528
529 BlockEntryInstr* Instruction::SuccessorAt(intptr_t index) const { 529 BlockEntryInstr* Instruction::SuccessorAt(intptr_t index) const {
530 return StraightLineSuccessor()->AsBlockEntry(); 530 return StraightLineSuccessor()->AsBlockEntry();
531 } 531 }
532 532
533 533
534 void Instruction::SetSuccessor(Instruction* instr) {
srdjan 2012/06/25 15:57:16 The two methods are (at least now) very simple set
Florian Schneider 2012/07/02 09:20:42 Done.
535 ASSERT(!IsGraphEntry());
536 ASSERT(!IsReturn());
537 ASSERT(!IsBranch());
538 ASSERT(!IsPhi());
539 // TODO(fschneider): Also add Throw and ReThrow to the list of instructions
540 // that do not have a successor. Currently, the graph builder will continue
541 // to append instruction in case of a Throw inside an expression. This
542 // condition should be handled in the graph builder
543 successor_ = instr;
544 }
545
546
547 void Instruction::SetPrevious(Instruction* instr) {
548 ASSERT(!IsBlockEntry());
549 previous_ = instr;
550 }
551
552
553 void Instruction::RemoveFromGraph() {
554 ASSERT(!IsBlockEntry());
555 ASSERT(Previous() != NULL);
556 Instruction* next = StraightLineSuccessor();
557 Previous()->SetSuccessor(next);
558 if (next != NULL && !next->IsBlockEntry()) {
srdjan 2012/06/25 15:57:16 Add parenthesis. Quick question: when is it possib
Florian Schneider 2012/07/02 09:20:42 It can happen. But this just made me realize that
559 next->SetPrevious(Previous());
560 }
srdjan 2012/06/25 15:57:16 Set successor and previous of this instruction to
Florian Schneider 2012/07/02 09:20:42 Done.
561 }
562
563
534 intptr_t GraphEntryInstr::SuccessorCount() const { 564 intptr_t GraphEntryInstr::SuccessorCount() const {
535 return 1 + catch_entries_.length(); 565 return 1 + catch_entries_.length();
536 } 566 }
537 567
538 568
539 BlockEntryInstr* GraphEntryInstr::SuccessorAt(intptr_t index) const { 569 BlockEntryInstr* GraphEntryInstr::SuccessorAt(intptr_t index) const {
540 if (index == 0) return normal_entry_; 570 if (index == 0) return normal_entry_;
541 return catch_entries_[index - 1]; 571 return catch_entries_[index - 1];
542 } 572 }
543 573
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); 1337 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint());
1308 compiler->GenerateCall(token_pos(), try_index(), &label, 1338 compiler->GenerateCall(token_pos(), try_index(), &label,
1309 PcDescriptors::kOther); 1339 PcDescriptors::kOther);
1310 __ Drop(2); // Discard type arguments and receiver. 1340 __ Drop(2); // Discard type arguments and receiver.
1311 } 1341 }
1312 1342
1313 1343
1314 #undef __ 1344 #undef __
1315 1345
1316 } // namespace dart 1346 } // namespace dart
OLDNEW
« vm/intermediate_language.h ('K') | « vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698