 Chromium Code Reviews
 Chromium Code Reviews Issue 5971003:
  Fix GVN for polymorphic loads....  (Closed) 
  Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
    
  
    Issue 5971003:
  Fix GVN for polymorphic loads....  (Closed) 
  Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/| Index: src/hydrogen.cc | 
| =================================================================== | 
| --- src/hydrogen.cc (revision 6079) | 
| +++ src/hydrogen.cc (working copy) | 
| @@ -1455,6 +1455,13 @@ | 
| HBasicBlock* loop_header) { | 
| if (!instr->IsChange() && | 
| FLAG_aggressive_loop_invariant_motion) return true; | 
| + | 
| + // Don't hoist named loads that are part of polymorphic loads. | 
| + if (instr->IsLoadNamedField() && | 
| 
Kevin Millikin (Chromium)
2010/12/20 12:34:34
You could accomplish essentially the same thing by
 | 
| + HLoadNamedField::cast(instr)->is_polymorphic()) { | 
| + return false; | 
| + } | 
| + | 
| HBasicBlock* block = instr->block(); | 
| bool result = true; | 
| if (block != loop_header) { | 
| @@ -3532,9 +3539,10 @@ | 
| maps.Add(map); | 
| HSubgraph* subgraph = CreateBranchSubgraph(environment()); | 
| SubgraphScope scope(this, subgraph); | 
| - HInstruction* instr = | 
| + HLoadNamedField* instr = | 
| BuildLoadNamedField(object, expr, map, &lookup, false); | 
| instr->set_position(expr->position()); | 
| + instr->set_is_polymorphic(true); | 
| PushAndAdd(instr); | 
| subgraphs.Add(subgraph); | 
| } else { | 
| @@ -3573,11 +3581,11 @@ | 
| } | 
| -HInstruction* HGraphBuilder::BuildLoadNamedField(HValue* object, | 
| - Property* expr, | 
| - Handle<Map> type, | 
| - LookupResult* lookup, | 
| - bool smi_and_map_check) { | 
| +HLoadNamedField* HGraphBuilder::BuildLoadNamedField(HValue* object, | 
| + Property* expr, | 
| + Handle<Map> type, | 
| + LookupResult* lookup, | 
| + bool smi_and_map_check) { | 
| if (smi_and_map_check) { | 
| AddInstruction(new HCheckNonSmi(object)); | 
| AddInstruction(new HCheckMap(object, type)); |