Fix GVN for polymorphic loads.

They must not be hoisted above the compare-map-and-branch.

Review URL: http://codereview.chromium.org/5971003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6082 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a496150a
...@@ -3532,9 +3532,10 @@ void HGraphBuilder::HandlePolymorphicLoadNamedField(Property* expr, ...@@ -3532,9 +3532,10 @@ void HGraphBuilder::HandlePolymorphicLoadNamedField(Property* expr,
maps.Add(map); maps.Add(map);
HSubgraph* subgraph = CreateBranchSubgraph(environment()); HSubgraph* subgraph = CreateBranchSubgraph(environment());
SubgraphScope scope(this, subgraph); SubgraphScope scope(this, subgraph);
HInstruction* instr = HLoadNamedField* instr =
BuildLoadNamedField(object, expr, map, &lookup, false); BuildLoadNamedField(object, expr, map, &lookup, false);
instr->set_position(expr->position()); instr->set_position(expr->position());
instr->ClearFlag(HValue::kUseGVN); // Don't do GVN on polymorphic loads.
PushAndAdd(instr); PushAndAdd(instr);
subgraphs.Add(subgraph); subgraphs.Add(subgraph);
} else { } else {
...@@ -3573,11 +3574,11 @@ void HGraphBuilder::HandlePolymorphicLoadNamedField(Property* expr, ...@@ -3573,11 +3574,11 @@ void HGraphBuilder::HandlePolymorphicLoadNamedField(Property* expr,
} }
HInstruction* HGraphBuilder::BuildLoadNamedField(HValue* object, HLoadNamedField* HGraphBuilder::BuildLoadNamedField(HValue* object,
Property* expr, Property* expr,
Handle<Map> type, Handle<Map> type,
LookupResult* lookup, LookupResult* lookup,
bool smi_and_map_check) { bool smi_and_map_check) {
if (smi_and_map_check) { if (smi_and_map_check) {
AddInstruction(new HCheckNonSmi(object)); AddInstruction(new HCheckNonSmi(object));
AddInstruction(new HCheckMap(object, type)); AddInstruction(new HCheckMap(object, type));
......
...@@ -786,11 +786,11 @@ class HGraphBuilder: public AstVisitor { ...@@ -786,11 +786,11 @@ class HGraphBuilder: public AstVisitor {
HValue* left, HValue* left,
HValue* right); HValue* right);
HInstruction* BuildIncrement(HValue* value, bool increment); HInstruction* BuildIncrement(HValue* value, bool increment);
HInstruction* BuildLoadNamedField(HValue* object, HLoadNamedField* BuildLoadNamedField(HValue* object,
Property* expr, Property* expr,
Handle<Map> type, Handle<Map> type,
LookupResult* result, LookupResult* result,
bool smi_and_map_check); bool smi_and_map_check);
HInstruction* BuildLoadNamedGeneric(HValue* object, Property* expr); HInstruction* BuildLoadNamedGeneric(HValue* object, Property* expr);
HInstruction* BuildLoadKeyedFastElement(HValue* object, HInstruction* BuildLoadKeyedFastElement(HValue* object,
HValue* key, HValue* key,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment