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

Side by Side Diff: runtime/vm/flow_graph_builder.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 | « no previous file | runtime/vm/flow_graph_compiler.cc » ('j') | 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/flow_graph_builder.h" 5 #include "vm/flow_graph_builder.h"
6 6
7 #include "vm/ast_printer.h" 7 #include "vm/ast_printer.h"
8 #include "vm/bit_vector.h" 8 #include "vm/bit_vector.h"
9 #include "vm/code_descriptors.h" 9 #include "vm/code_descriptors.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 2202 matching lines...) Expand 10 before | Expand all | Expand 10 after
2213 &assigned_vars, 2213 &assigned_vars,
2214 variable_count); 2214 variable_count);
2215 // Number blocks in reverse postorder. 2215 // Number blocks in reverse postorder.
2216 intptr_t block_count = postorder_block_entries_.length(); 2216 intptr_t block_count = postorder_block_entries_.length();
2217 for (intptr_t i = 0; i < block_count; ++i) { 2217 for (intptr_t i = 0; i < block_count; ++i) {
2218 postorder_block_entries_[i]->set_block_id(block_count - i - 1); 2218 postorder_block_entries_[i]->set_block_id(block_count - i - 1);
2219 } 2219 }
2220 if (for_optimized && use_ssa) { 2220 if (for_optimized && use_ssa) {
2221 // Link instructions backwards for optimized compilation. 2221 // Link instructions backwards for optimized compilation.
2222 for (intptr_t i = 0; i < block_count; ++i) { 2222 for (intptr_t i = 0; i < block_count; ++i) {
2223 Instruction* prev = postorder_block_entries_[i]; 2223 BlockEntryInstr* entry = postorder_block_entries_[i];
2224 Instruction* current = prev->next(); 2224 Instruction* previous = entry;
2225 while (current != NULL && !current->IsBlockEntry()) { 2225 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) {
2226 current->set_previous(prev); 2226 Instruction* current = it.Current();
2227 prev = current; 2227 current->set_previous(previous);
2228 current = current->next(); 2228 previous = current;
2229 } 2229 }
2230 } 2230 }
2231 GrowableArray<BitVector*> dominance_frontier; 2231 GrowableArray<BitVector*> dominance_frontier;
2232 ComputeDominators(&preorder_block_entries_, &parent, &dominance_frontier); 2232 ComputeDominators(&preorder_block_entries_, &parent, &dominance_frontier);
2233 InsertPhis(preorder_block_entries_, 2233 InsertPhis(preorder_block_entries_,
2234 assigned_vars, 2234 assigned_vars,
2235 variable_count, 2235 variable_count,
2236 dominance_frontier); 2236 dominance_frontier);
2237 Rename(variable_count); 2237 Rename(variable_count);
2238 } 2238 }
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
2619 char* chars = reinterpret_cast<char*>( 2619 char* chars = reinterpret_cast<char*>(
2620 Isolate::Current()->current_zone()->Allocate(len)); 2620 Isolate::Current()->current_zone()->Allocate(len));
2621 OS::SNPrint(chars, len, kFormat, function_name, reason); 2621 OS::SNPrint(chars, len, kFormat, function_name, reason);
2622 const Error& error = Error::Handle( 2622 const Error& error = Error::Handle(
2623 LanguageError::New(String::Handle(String::New(chars)))); 2623 LanguageError::New(String::Handle(String::New(chars))));
2624 Isolate::Current()->long_jump_base()->Jump(1, error); 2624 Isolate::Current()->long_jump_base()->Jump(1, error);
2625 } 2625 }
2626 2626
2627 2627
2628 } // namespace dart 2628 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698