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

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

Issue 2379733002: Recognize and optimize a.runtimeType == b.runtimeType pattern. (Closed)
Patch Set: fix lint Created 4 years, 1 month 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/compiler.cc ('k') | runtime/vm/flow_graph_inliner.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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 replacement_defn->ssa_temp_index()); 77 replacement_defn->ssa_temp_index());
78 } 78 }
79 } else if (FLAG_trace_optimization) { 79 } else if (FLAG_trace_optimization) {
80 if (current_defn == NULL) { 80 if (current_defn == NULL) {
81 THR_Print("Removing %s\n", current->DebugName()); 81 THR_Print("Removing %s\n", current->DebugName());
82 } else { 82 } else {
83 ASSERT(!current_defn->HasUses()); 83 ASSERT(!current_defn->HasUses());
84 THR_Print("Removing v%" Pd ".\n", current_defn->ssa_temp_index()); 84 THR_Print("Removing v%" Pd ".\n", current_defn->ssa_temp_index());
85 } 85 }
86 } 86 }
87 if (current->ArgumentCount() != 0) {
88 // This is a call instruction. Must remove original push arguments.
89 for (intptr_t i = 0; i < current->ArgumentCount(); ++i) {
90 PushArgumentInstr* push = current->PushArgumentAt(i);
91 push->ReplaceUsesWith(push->value()->definition());
92 push->RemoveFromGraph();
93 }
94 }
87 iterator->RemoveCurrentFromGraph(); 95 iterator->RemoveCurrentFromGraph();
88 } 96 }
89 97
90 98
91 void FlowGraph::AddToDeferredPrefixes( 99 void FlowGraph::AddToDeferredPrefixes(
92 ZoneGrowableArray<const LibraryPrefix*>* from) { 100 ZoneGrowableArray<const LibraryPrefix*>* from) {
93 ZoneGrowableArray<const LibraryPrefix*>* to = deferred_prefixes(); 101 ZoneGrowableArray<const LibraryPrefix*>* to = deferred_prefixes();
94 for (intptr_t i = 0; i < from->length(); i++) { 102 for (intptr_t i = 0; i < from->length(); i++) {
95 const LibraryPrefix* prefix = (*from)[i]; 103 const LibraryPrefix* prefix = (*from)[i];
96 for (intptr_t j = 0; j < to->length(); j++) { 104 for (intptr_t j = 0; j < to->length(); j++) {
(...skipping 2213 matching lines...) Expand 10 before | Expand all | Expand 10 after
2310 ExtractNthOutputInstr* extract = 2318 ExtractNthOutputInstr* extract =
2311 new(Z) ExtractNthOutputInstr(new(Z) Value(instr), index, rep, cid); 2319 new(Z) ExtractNthOutputInstr(new(Z) Value(instr), index, rep, cid);
2312 instr->ReplaceUsesWith(extract); 2320 instr->ReplaceUsesWith(extract);
2313 InsertAfter(instr, extract, NULL, FlowGraph::kValue); 2321 InsertAfter(instr, extract, NULL, FlowGraph::kValue);
2314 } 2322 }
2315 2323
2316 2324
2317 2325
2318 2326
2319 } // namespace dart 2327 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/flow_graph_inliner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698