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

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

Issue 10704119: Use the instruction iterator rather than an explicit loop in more places. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « runtime/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/dart_entry.h" 8 #include "vm/dart_entry.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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 void ClassName::Accept(FlowGraphVisitor* visitor, BindInstr* instr) { \ 57 void ClassName::Accept(FlowGraphVisitor* visitor, BindInstr* instr) { \
58 visitor->Visit##ShortName(this, instr); \ 58 visitor->Visit##ShortName(this, instr); \
59 } 59 }
60 60
61 FOR_EACH_COMPUTATION(DEFINE_ACCEPT) 61 FOR_EACH_COMPUTATION(DEFINE_ACCEPT)
62 62
63 #undef DEFINE_ACCEPT 63 #undef DEFINE_ACCEPT
64 64
65 65
66 #define DEFINE_ACCEPT(ShortName) \ 66 #define DEFINE_ACCEPT(ShortName) \
67 Instruction* ShortName##Instr::Accept(FlowGraphVisitor* visitor) { \ 67 void ShortName##Instr::Accept(FlowGraphVisitor* visitor) { \
68 visitor->Visit##ShortName(this); \ 68 visitor->Visit##ShortName(this); \
69 return next(); \
70 } 69 }
71 70
72 FOR_EACH_INSTRUCTION(DEFINE_ACCEPT) 71 FOR_EACH_INSTRUCTION(DEFINE_ACCEPT)
73 72
74 #undef DEFINE_ACCEPT 73 #undef DEFINE_ACCEPT
75 74
76 75
77 // True iff. the v2 is above v1 on stack, or one of them is constant. 76 // True iff. the v2 is above v1 on stack, or one of them is constant.
78 static bool VerifyValues(Value* v1, Value* v2) { 77 static bool VerifyValues(Value* v1, Value* v2) {
79 ASSERT(v1->IsUse() && v2->IsUse()); 78 ASSERT(v1->IsUse() && v2->IsUse());
80 return (v1->AsUse()->definition()->temp_index() + 1) == 79 return (v1->AsUse()->definition()->temp_index() + 1) ==
81 v2->AsUse()->definition()->temp_index(); 80 v2->AsUse()->definition()->temp_index();
82 } 81 }
83 82
84 83
85 // Default implementation of visiting basic blocks. Can be overridden. 84 // Default implementation of visiting basic blocks. Can be overridden.
86 void FlowGraphVisitor::VisitBlocks() { 85 void FlowGraphVisitor::VisitBlocks() {
87 for (intptr_t i = 0; i < block_order_.length(); ++i) { 86 for (intptr_t i = 0; i < block_order_.length(); ++i) {
88 Instruction* current = block_order_[i]->Accept(this); 87 BlockEntryInstr* entry = block_order_[i];
89 while ((current != NULL) && !current->IsBlockEntry()) { 88 entry->Accept(this);
90 current = current->Accept(this); 89 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) {
90 it.Current()->Accept(this);
91 } 91 }
92 } 92 }
93 } 93 }
94 94
95 95
96 intptr_t InstanceCallComp::InputCount() const { 96 intptr_t InstanceCallComp::InputCount() const {
97 return ArgumentCount(); 97 return ArgumentCount();
98 } 98 }
99 99
100 100
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); 1293 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint());
1294 compiler->GenerateCall(token_pos(), try_index(), &label, 1294 compiler->GenerateCall(token_pos(), try_index(), &label,
1295 PcDescriptors::kOther); 1295 PcDescriptors::kOther);
1296 __ Drop(2); // Discard type arguments and receiver. 1296 __ Drop(2); // Discard type arguments and receiver.
1297 } 1297 }
1298 1298
1299 1299
1300 #undef __ 1300 #undef __
1301 1301
1302 } // namespace dart 1302 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698