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

Side by Side Diff: runtime/vm/intermediate_language.cc

Issue 806973002: Cleanup access to Instruction's fields (especially deopt_id_). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years 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
OLDNEW
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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 call->ArgumentCount(), 749 call->ArgumentCount(),
750 flow_graph->constant_dead(), 750 flow_graph->constant_dead(),
751 result != NULL ? result 751 result != NULL ? result
752 : flow_graph->constant_dead()); 752 : flow_graph->constant_dead());
753 env()->set_deopt_id(deopt_id_); 753 env()->set_deopt_id(deopt_id_);
754 } 754 }
755 755
756 756
757 void Instruction::InheritDeoptTarget(Isolate* isolate, Instruction* other) { 757 void Instruction::InheritDeoptTarget(Isolate* isolate, Instruction* other) {
758 ASSERT(other->env() != NULL); 758 ASSERT(other->env() != NULL);
759 deopt_id_ = other->deopt_id_; 759 CopyDeoptIdFrom(*other);
760 other->env()->DeepCopyTo(isolate, this); 760 other->env()->DeepCopyTo(isolate, this);
761 env()->set_deopt_id(deopt_id_); 761 env()->set_deopt_id(deopt_id_);
762 } 762 }
763 763
764 764
765 void BranchInstr::InheritDeoptTarget(Isolate* isolate, Instruction* other) { 765 void BranchInstr::InheritDeoptTarget(Isolate* isolate, Instruction* other) {
766 ASSERT(env() == NULL); 766 ASSERT(env() == NULL);
767 Instruction::InheritDeoptTarget(isolate, other); 767 Instruction::InheritDeoptTarget(isolate, other);
768 comparison()->SetDeoptId(GetDeoptId()); 768 comparison()->SetDeoptId(*this);
769 } 769 }
770 770
771 771
772 bool Instruction::IsDominatedBy(Instruction* dom) { 772 bool Instruction::IsDominatedBy(Instruction* dom) {
773 BlockEntryInstr* block = GetBlock(); 773 BlockEntryInstr* block = GetBlock();
774 BlockEntryInstr* dom_block = dom->GetBlock(); 774 BlockEntryInstr* dom_block = dom->GetBlock();
775 775
776 if (dom->IsPhi()) { 776 if (dom->IsPhi()) {
777 dom = dom_block; 777 dom = dom_block;
778 } 778 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 void Definition::ReplaceWith(Definition* other, 812 void Definition::ReplaceWith(Definition* other,
813 ForwardInstructionIterator* iterator) { 813 ForwardInstructionIterator* iterator) {
814 // Record other's input uses. 814 // Record other's input uses.
815 for (intptr_t i = other->InputCount() - 1; i >= 0; --i) { 815 for (intptr_t i = other->InputCount() - 1; i >= 0; --i) {
816 Value* input = other->InputAt(i); 816 Value* input = other->InputAt(i);
817 input->definition()->AddInputUse(input); 817 input->definition()->AddInputUse(input);
818 } 818 }
819 // Take other's environment from this definition. 819 // Take other's environment from this definition.
820 ASSERT(other->env() == NULL); 820 ASSERT(other->env() == NULL);
821 other->SetEnvironment(env()); 821 other->SetEnvironment(env());
822 env_ = NULL; 822 ClearEnv();
823 // Replace all uses of this definition with other. 823 // Replace all uses of this definition with other.
824 ReplaceUsesWith(other); 824 ReplaceUsesWith(other);
825 // Reuse this instruction's SSA name for other. 825 // Reuse this instruction's SSA name for other.
826 ASSERT(!other->HasSSATemp()); 826 ASSERT(!other->HasSSATemp());
827 if (HasSSATemp()) { 827 if (HasSSATemp()) {
828 other->set_ssa_temp_index(ssa_temp_index()); 828 other->set_ssa_temp_index(ssa_temp_index());
829 } 829 }
830 830
831 // Finally insert the other definition in place of this one in the graph. 831 // Finally insert the other definition in place of this one in the graph.
832 previous()->LinkTo(other); 832 previous()->LinkTo(other);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 // Sanity check that we found a stack check instruction. 946 // Sanity check that we found a stack check instruction.
947 ASSERT(instr->IsCheckStackOverflow()); 947 ASSERT(instr->IsCheckStackOverflow());
948 // Loop stack check checks are always in join blocks so that they can 948 // Loop stack check checks are always in join blocks so that they can
949 // be the target of a goto. 949 // be the target of a goto.
950 ASSERT(IsJoinEntry()); 950 ASSERT(IsJoinEntry());
951 // The instruction should be the first instruction in the block so 951 // The instruction should be the first instruction in the block so
952 // we can simply jump to the beginning of the block. 952 // we can simply jump to the beginning of the block.
953 ASSERT(instr->previous() == this); 953 ASSERT(instr->previous() == this);
954 954
955 GotoInstr* goto_join = new GotoInstr(AsJoinEntry()); 955 GotoInstr* goto_join = new GotoInstr(AsJoinEntry());
956 goto_join->deopt_id_ = parent->deopt_id_; 956 goto_join->CopyDeoptIdFrom(*parent);
957 graph_entry->normal_entry()->LinkTo(goto_join); 957 graph_entry->normal_entry()->LinkTo(goto_join);
958 return true; 958 return true;
959 } 959 }
960 } 960 }
961 961
962 // Recursively search the successors. 962 // Recursively search the successors.
963 for (intptr_t i = instr->SuccessorCount() - 1; i >= 0; --i) { 963 for (intptr_t i = instr->SuccessorCount() - 1; i >= 0; --i) {
964 if (instr->SuccessorAt(i)->PruneUnreachable(builder, 964 if (instr->SuccessorAt(i)->PruneUnreachable(builder,
965 graph_entry, 965 graph_entry,
966 instr, 966 instr,
(...skipping 2511 matching lines...) Expand 10 before | Expand all | Expand 10 after
3478 case Token::kTRUNCDIV: return 0; 3478 case Token::kTRUNCDIV: return 0;
3479 case Token::kMOD: return 1; 3479 case Token::kMOD: return 1;
3480 default: UNIMPLEMENTED(); return -1; 3480 default: UNIMPLEMENTED(); return -1;
3481 } 3481 }
3482 } 3482 }
3483 3483
3484 3484
3485 #undef __ 3485 #undef __
3486 3486
3487 } // namespace dart 3487 } // namespace dart
OLDNEW
« runtime/vm/intermediate_language.h ('K') | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698