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

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

Issue 12335063: Add functions for setting an environment and rebinding a use. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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) 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/flow_graph_inliner.h" 5 #include "vm/flow_graph_inliner.h"
6 6
7 #include "vm/compiler.h" 7 #include "vm/compiler.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/flow_graph.h" 9 #include "vm/flow_graph.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 for (intptr_t i = 0; i < arguments->length(); ++i) { 566 for (intptr_t i = 0; i < arguments->length(); ++i) {
567 Definition* stub = param_stubs[i]; 567 Definition* stub = param_stubs[i];
568 Value* actual = (*arguments)[i]; 568 Value* actual = (*arguments)[i];
569 if (actual != NULL) stub->ReplaceUsesWith(actual->definition()); 569 if (actual != NULL) stub->ReplaceUsesWith(actual->definition());
570 } 570 }
571 571
572 // Remove push arguments of the call. 572 // Remove push arguments of the call.
573 for (intptr_t i = 0; i < call->ArgumentCount(); ++i) { 573 for (intptr_t i = 0; i < call->ArgumentCount(); ++i) {
574 PushArgumentInstr* push = call->PushArgumentAt(i); 574 PushArgumentInstr* push = call->PushArgumentAt(i);
575 push->ReplaceUsesWith(push->value()->definition()); 575 push->ReplaceUsesWith(push->value()->definition());
576 push->UnuseAllInputs();
577 push->RemoveFromGraph(); 576 push->RemoveFromGraph();
578 } 577 }
579 578
580 // Replace remaining constants with uses by constants in the caller's 579 // Replace remaining constants with uses by constants in the caller's
581 // initial definitions. 580 // initial definitions.
582 GrowableArray<Definition*>* defns = 581 GrowableArray<Definition*>* defns =
583 callee_graph->graph_entry()->initial_definitions(); 582 callee_graph->graph_entry()->initial_definitions();
584 for (intptr_t i = 0; i < defns->length(); ++i) { 583 for (intptr_t i = 0; i < defns->length(); ++i) {
585 ConstantInstr* constant = (*defns)[i]->AsConstant(); 584 ConstantInstr* constant = (*defns)[i]->AsConstant();
586 if ((constant != NULL) && constant->HasUses()) { 585 if ((constant != NULL) && constant->HasUses()) {
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 OS::Print("After Inlining of %s\n", flow_graph_-> 868 OS::Print("After Inlining of %s\n", flow_graph_->
870 parsed_function().function().ToFullyQualifiedCString()); 869 parsed_function().function().ToFullyQualifiedCString());
871 FlowGraphPrinter printer(*flow_graph_); 870 FlowGraphPrinter printer(*flow_graph_);
872 printer.PrintBlocks(); 871 printer.PrintBlocks();
873 } 872 }
874 } 873 }
875 } 874 }
876 } 875 }
877 876
878 } // namespace dart 877 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698