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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 10809047: Cleanups. (Closed) Base URL: http://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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/flow_graph_allocator.cc ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_builder.cc
===================================================================
--- runtime/vm/flow_graph_builder.cc (revision 9794)
+++ runtime/vm/flow_graph_builder.cc (working copy)
@@ -385,10 +385,12 @@
return;
}
+
void ValueGraphVisitor::VisitLiteralNode(LiteralNode* node) {
ReturnComputation(new ConstantVal(node->literal()));
}
+
// Type nodes only occur as the right-hand side of instanceof comparisons,
// and they are handled specially in that context.
void EffectGraphVisitor::VisitTypeNode(TypeNode* node) { UNREACHABLE(); }
@@ -2535,7 +2537,7 @@
Bailout("Catch-entry support in SSA.");
}
// TODO(fschneider): Support copied parameters.
- if (parsed_function().copied_parameter_count()) {
+ if (parsed_function().copied_parameter_count() != 0) {
Bailout("Copied parameter support in SSA");
}
ASSERT(var_count == (parsed_function().stack_local_count() +
@@ -2565,16 +2567,6 @@
}
-static intptr_t WhichPred(BlockEntryInstr* predecessor,
- JoinEntryInstr* join_block) {
- for (intptr_t i = 0; i < join_block->PredecessorCount(); ++i) {
- if (join_block->PredecessorAt(i) == predecessor) return i;
- }
- UNREACHABLE();
- return -1;
-}
-
-
// Helper to a copy a value iff it is a UseVal.
static Value* CopyValue(Value* value) {
return value->IsUse()
@@ -2619,17 +2611,16 @@
// Update expression stack.
ASSERT(env->length() > var_count);
env->RemoveLast();
- if (v->AsUse()->definition()->IsBind() &&
- v->AsUse()->definition()->AsBind()->computation()->IsLoadLocal()) {
- Computation* comp = v->AsUse()->definition()->AsBind()->computation();
+ BindInstr* as_bind = v->AsUse()->definition()->AsBind();
+ if ((as_bind != NULL) && as_bind->computation()->IsLoadLocal()) {
+ Computation* comp = as_bind->computation();
intptr_t index = comp->AsLoadLocal()->local().BitIndexIn(var_count);
current->SetInputAt(i, CopyValue((*env)[index]));
}
- if (v->AsUse()->definition()->IsBind() &&
- v->AsUse()->definition()->AsBind()->computation()->IsStoreLocal()) {
+ if ((as_bind != NULL) && as_bind->computation()->IsStoreLocal()) {
// For each use of a StoreLocal: Replace it with the value from the
// environment.
- Computation* comp = v->AsUse()->definition()->AsBind()->computation();
+ Computation* comp = as_bind->computation();
intptr_t index = comp->AsStoreLocal()->local().BitIndexIn(var_count);
current->SetInputAt(i, CopyValue((*env)[index]));
}
@@ -2684,7 +2675,8 @@
block_entry->last_instruction()->SuccessorAt(0)->IsJoinEntry()) {
JoinEntryInstr* successor =
block_entry->last_instruction()->SuccessorAt(0)->AsJoinEntry();
- intptr_t pred_index = WhichPred(block_entry, successor);
+ intptr_t pred_index = successor->IndexOfPredecessor(block_entry);
+ ASSERT(pred_index >= 0);
if (successor->phis() != NULL) {
for (intptr_t i = 0; i < successor->phis()->length(); ++i) {
PhiInstr* phi = (*successor->phis())[i];
« no previous file with comments | « runtime/vm/flow_graph_allocator.cc ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698