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

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

Issue 2716593002: Propagate this-specialization to regular (megamorphic) calls (Closed)
Patch Set: Created 3 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
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 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after
1989 Instruction* current = it.Current(); 1989 Instruction* current = it.Current();
1990 if (current->HasUnmatchedInputRepresentations()) { 1990 if (current->HasUnmatchedInputRepresentations()) {
1991 // Can't canonicalize this instruction until all conversions for its 1991 // Can't canonicalize this instruction until all conversions for its
1992 // inputs are inserted. 1992 // inputs are inserted.
1993 continue; 1993 continue;
1994 } 1994 }
1995 1995
1996 Instruction* replacement = current->Canonicalize(this); 1996 Instruction* replacement = current->Canonicalize(this);
1997 1997
1998 if (replacement != current) { 1998 if (replacement != current) {
1999 // For non-definitions Canonicalize should return either NULL or
2000 // this.
2001 ASSERT((replacement == NULL) || current->IsDefinition());
2002 ReplaceCurrentInstruction(&it, current, replacement);
2003 changed = true; 1999 changed = true;
2000
2001 if (current->IsInstanceCall()) {
2002 current->AsDefinition()->ReplaceWith(replacement->AsDefinition(),
2003 &it);
2004 } else {
2005 // For non-definitions Canonicalize should return either NULL or
2006 // this.
2007 ASSERT((replacement == NULL) || current->IsDefinition());
2008 ReplaceCurrentInstruction(&it, current, replacement);
2009 }
2004 } 2010 }
2005 } 2011 }
2006 } 2012 }
2007 return changed; 2013 return changed;
2008 } 2014 }
2009 2015
2010 2016
2011 // Optimize (a << b) & c pattern: if c is a positive Smi or zero, then the 2017 // Optimize (a << b) & c pattern: if c is a positive Smi or zero, then the
2012 // shift can be a truncating Smi shift-left and result is always Smi. 2018 // shift can be a truncating Smi shift-left and result is always Smi.
2013 // Merging occurs only per basic-block. 2019 // Merging occurs only per basic-block.
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
2229 Representation rep, 2235 Representation rep,
2230 intptr_t cid) { 2236 intptr_t cid) {
2231 ExtractNthOutputInstr* extract = 2237 ExtractNthOutputInstr* extract =
2232 new (Z) ExtractNthOutputInstr(new (Z) Value(instr), index, rep, cid); 2238 new (Z) ExtractNthOutputInstr(new (Z) Value(instr), index, rep, cid);
2233 instr->ReplaceUsesWith(extract); 2239 instr->ReplaceUsesWith(extract);
2234 InsertAfter(instr, extract, NULL, FlowGraph::kValue); 2240 InsertAfter(instr, extract, NULL, FlowGraph::kValue);
2235 } 2241 }
2236 2242
2237 2243
2238 } // namespace dart 2244 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698