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

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

Issue 9447102: Implement x64 compilation for loading and storing local variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Bugfix and rebase to HEAD. Created 8 years, 10 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
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/object.h" 7 #include "vm/object.h"
8 #include "vm/os.h" 8 #include "vm/os.h"
9 #include "vm/scopes.h" 9 #include "vm/scopes.h"
10 10
11 namespace dart { 11 namespace dart {
12 12
13 // ==== Printing support. 13 // ==== Support for visiting flow graphs.
14 void AssertAssignableComp::Print() const { 14 #define DEFINE_ACCEPT(ShortName, ClassName) \
15 OS::Print("AssertAssignable("); 15 void ClassName::Accept(FlowGraphVisitor* visitor) { \
16 value_->Print(); 16 visitor->Visit##ShortName(this); \
17 OS::Print(", %s)", type_.ToCString()); 17 }
18 } 18
19 FOR_EACH_COMPUTATION(DEFINE_ACCEPT)
20
21 #undef DEFINE_ACCEPT
19 22
20 23
21 void InstanceCallComp::Print() const { 24 Instruction* JoinEntryInstr::Accept(FlowGraphVisitor* visitor) {
22 OS::Print("InstanceCall(%s", name_);
23 for (intptr_t i = 0; i < arguments_->length(); ++i) {
24 OS::Print(", ");
25 (*arguments_)[i]->Print();
26 }
27 OS::Print(")");
28 }
29
30
31 void StrictCompareComp::Print() const {
32 OS::Print("StrictCompare(%s, ", Token::Str(kind_));
33 left_->Print();
34 OS::Print(", ");
35 right_->Print();
36 OS::Print(")");
37 }
38
39
40
41 void StaticCallComp::Print() const {
42 OS::Print("StaticCall(%s", String::Handle(function_.name()).ToCString());
43 for (intptr_t i = 0; i < arguments_->length(); ++i) {
44 OS::Print(", ");
45 (*arguments_)[i]->Print();
46 }
47 OS::Print(")");
48 }
49
50
51 void LoadLocalComp::Print() const {
52 OS::Print("LoadLocal(%s)", local_.name().ToCString());
53 }
54
55
56 void StoreLocalComp::Print() const {
57 OS::Print("StoreLocal(%s, ", local_.name().ToCString());
58 value_->Print();
59 OS::Print(")");
60 }
61
62
63 void TempValue::Print() const {
64 OS::Print("t%d", index_);
65 }
66
67
68 void ConstantValue::Print() const {
69 OS::Print("#%s", instance_.ToCString());
70 }
71
72
73 // ==== Support for visiting instructions.
74 Instruction* JoinEntryInstr::Accept(InstructionVisitor* visitor) {
75 visitor->VisitJoinEntry(this); 25 visitor->VisitJoinEntry(this);
76 return successor_; 26 return successor_;
77 } 27 }
78 28
79 29
80 Instruction* TargetEntryInstr::Accept(InstructionVisitor* visitor) { 30 Instruction* TargetEntryInstr::Accept(FlowGraphVisitor* visitor) {
81 visitor->VisitTargetEntry(this); 31 visitor->VisitTargetEntry(this);
82 return successor_; 32 return successor_;
83 } 33 }
84 34
85 35
86 Instruction* DoInstr::Accept(InstructionVisitor* visitor) { 36 Instruction* DoInstr::Accept(FlowGraphVisitor* visitor) {
87 visitor->VisitDo(this); 37 visitor->VisitDo(this);
88 return successor_; 38 return successor_;
89 } 39 }
90 40
91 41
92 Instruction* BindInstr::Accept(InstructionVisitor* visitor) { 42 Instruction* BindInstr::Accept(FlowGraphVisitor* visitor) {
93 visitor->VisitBind(this); 43 visitor->VisitBind(this);
94 return successor_; 44 return successor_;
95 } 45 }
96 46
97 47
98 Instruction* ReturnInstr::Accept(InstructionVisitor* visitor) { 48 Instruction* ReturnInstr::Accept(FlowGraphVisitor* visitor) {
99 visitor->VisitReturn(this); 49 visitor->VisitReturn(this);
100 return NULL; 50 return NULL;
101 } 51 }
102 52
103 53
104 Instruction* BranchInstr::Accept(InstructionVisitor* visitor) { 54 Instruction* BranchInstr::Accept(FlowGraphVisitor* visitor) {
105 visitor->VisitBranch(this); 55 visitor->VisitBranch(this);
106 return NULL; 56 return NULL;
107 } 57 }
108 58
109 59
110 // Default implementation of visiting basic blocks. Can be overridden. 60 // Default implementation of visiting basic blocks. Can be overridden.
111 void InstructionVisitor::VisitBlocks( 61 void FlowGraphVisitor::VisitBlocks(
112 const GrowableArray<BlockEntryInstr*>& block_order) { 62 const GrowableArray<BlockEntryInstr*>& block_order) {
113 for (intptr_t i = block_order.length() - 1; i >= 0; --i) { 63 for (intptr_t i = block_order.length() - 1; i >= 0; --i) {
114 Instruction* current = block_order[i]->Accept(this); 64 Instruction* current = block_order[i]->Accept(this);
115 while ((current != NULL) && !current->IsBlockEntry()) { 65 while ((current != NULL) && !current->IsBlockEntry()) {
116 current = current->Accept(this); 66 current = current->Accept(this);
117 } 67 }
118 } 68 }
119 } 69 }
120 70
121 71
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 109
160 void TargetEntryInstr::Postorder( 110 void TargetEntryInstr::Postorder(
161 GrowableArray<BlockEntryInstr*>* block_entries) { 111 GrowableArray<BlockEntryInstr*>* block_entries) {
162 flip_mark(); 112 flip_mark();
163 if (successor_->mark() != mark()) successor_->Postorder(block_entries); 113 if (successor_->mark() != mark()) successor_->Postorder(block_entries);
164 block_entries->Add(this); 114 block_entries->Add(this);
165 } 115 }
166 116
167 117
168 } // namespace dart 118 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698