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

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

Issue 2716593002: Propagate this-specialization to regular (megamorphic) calls (Closed)
Patch Set: Add new Canonicalize call to make use of type data Created 3 years, 9 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
« no previous file with comments | « runtime/vm/aot_optimizer.cc ('k') | runtime/vm/flow_graph_compiler.h » ('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.h" 5 #include "vm/flow_graph.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cha.h" 8 #include "vm/cha.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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 } 76 }
77 } else if (FLAG_trace_optimization) { 77 } else if (FLAG_trace_optimization) {
78 if (current_defn == NULL) { 78 if (current_defn == NULL) {
79 THR_Print("Removing %s\n", current->DebugName()); 79 THR_Print("Removing %s\n", current->DebugName());
80 } else { 80 } else {
81 ASSERT(!current_defn->HasUses()); 81 ASSERT(!current_defn->HasUses());
82 THR_Print("Removing v%" Pd ".\n", current_defn->ssa_temp_index()); 82 THR_Print("Removing v%" Pd ".\n", current_defn->ssa_temp_index());
83 } 83 }
84 } 84 }
85 if (current->ArgumentCount() != 0) { 85 if (current->ArgumentCount() != 0) {
86 // This is a call instruction. Must remove original push arguments. 86 // Replacing a call instruction with something else. Must remove
87 // superfluous push arguments.
87 for (intptr_t i = 0; i < current->ArgumentCount(); ++i) { 88 for (intptr_t i = 0; i < current->ArgumentCount(); ++i) {
88 PushArgumentInstr* push = current->PushArgumentAt(i); 89 PushArgumentInstr* push = current->PushArgumentAt(i);
89 push->ReplaceUsesWith(push->value()->definition()); 90 if (replacement == NULL || i >= replacement->ArgumentCount() ||
90 push->RemoveFromGraph(); 91 replacement->PushArgumentAt(i) != push) {
92 push->ReplaceUsesWith(push->value()->definition());
93 push->RemoveFromGraph();
94 }
91 } 95 }
92 } 96 }
93 iterator->RemoveCurrentFromGraph(); 97 iterator->RemoveCurrentFromGraph();
94 } 98 }
95 99
96 100
97 void FlowGraph::AddToDeferredPrefixes( 101 void FlowGraph::AddToDeferredPrefixes(
98 ZoneGrowableArray<const LibraryPrefix*>* from) { 102 ZoneGrowableArray<const LibraryPrefix*>* from) {
99 ZoneGrowableArray<const LibraryPrefix*>* to = deferred_prefixes(); 103 ZoneGrowableArray<const LibraryPrefix*>* to = deferred_prefixes();
100 for (intptr_t i = 0; i < from->length(); i++) { 104 for (intptr_t i = 0; i < from->length(); i++) {
(...skipping 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after
2274 Representation rep, 2278 Representation rep,
2275 intptr_t cid) { 2279 intptr_t cid) {
2276 ExtractNthOutputInstr* extract = 2280 ExtractNthOutputInstr* extract =
2277 new (Z) ExtractNthOutputInstr(new (Z) Value(instr), index, rep, cid); 2281 new (Z) ExtractNthOutputInstr(new (Z) Value(instr), index, rep, cid);
2278 instr->ReplaceUsesWith(extract); 2282 instr->ReplaceUsesWith(extract);
2279 InsertAfter(instr, extract, NULL, FlowGraph::kValue); 2283 InsertAfter(instr, extract, NULL, FlowGraph::kValue);
2280 } 2284 }
2281 2285
2282 2286
2283 } // namespace dart 2287 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/aot_optimizer.cc ('k') | runtime/vm/flow_graph_compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698