Commit 3837ef57 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Fix dependency of loading the heap-number for a double-field store to be the mapcheck.

R=jkummerow@chromium.org

Review URL: https://chromiumcodereview.appspot.com/22926027

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16306 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 885c88e4
...@@ -212,14 +212,8 @@ void HEscapeAnalysisPhase::AnalyzeDataFlow(HInstruction* allocate) { ...@@ -212,14 +212,8 @@ void HEscapeAnalysisPhase::AnalyzeDataFlow(HInstruction* allocate) {
if (mapcheck->value() != allocate) continue; if (mapcheck->value() != allocate) continue;
// TODO(mstarzinger): This approach breaks if the tracked map value // TODO(mstarzinger): This approach breaks if the tracked map value
// is not a HConstant. Find a repro test case and fix this. // is not a HConstant. Find a repro test case and fix this.
for (HUseIterator it(mapcheck->uses()); !it.Done(); it.Advance()) { ASSERT(mapcheck->ActualValue() == allocate);
if (!it.value()->IsLoadNamedField()) continue; mapcheck->DeleteAndReplaceWith(mapcheck->ActualValue());
HLoadNamedField* load = HLoadNamedField::cast(it.value());
load->ClearTypeCheck();
}
ASSERT(mapcheck->HasNoUses());
mapcheck->DeleteAndReplaceWith(NULL);
break; break;
} }
default: default:
......
...@@ -5599,7 +5599,6 @@ class HLoadNamedField V8_FINAL : public HTemplateInstruction<1> { ...@@ -5599,7 +5599,6 @@ class HLoadNamedField V8_FINAL : public HTemplateInstruction<1> {
HValue* object() { return OperandAt(0); } HValue* object() { return OperandAt(0); }
bool HasTypeCheck() { return object()->IsCheckMaps(); } bool HasTypeCheck() { return object()->IsCheckMaps(); }
void ClearTypeCheck() { SetOperandAt(0, object()->ActualValue()); }
HObjectAccess access() const { return access_; } HObjectAccess access() const { return access_; }
Representation field_representation() const { Representation field_representation() const {
return access_.representation(); return access_.representation();
......
...@@ -4443,7 +4443,7 @@ HCheckMaps* HOptimizedGraphBuilder::AddCheckMap(HValue* object, ...@@ -4443,7 +4443,7 @@ HCheckMaps* HOptimizedGraphBuilder::AddCheckMap(HValue* object,
HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField( HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField(
HValue* object, HValue* checked_object,
Handle<String> name, Handle<String> name,
HValue* value, HValue* value,
Handle<Map> map, Handle<Map> map,
...@@ -4495,11 +4495,12 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField( ...@@ -4495,11 +4495,12 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField(
AddStoreMapConstant(heap_number, isolate()->factory()->heap_number_map()); AddStoreMapConstant(heap_number, isolate()->factory()->heap_number_map());
Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(), Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(),
value); value);
instr = New<HStoreNamedField>(object, heap_number_access, instr = New<HStoreNamedField>(checked_object,
heap_number_access,
heap_number); heap_number);
} else { } else {
// Already holds a HeapNumber; load the box and write its value field. // Already holds a HeapNumber; load the box and write its value field.
HInstruction* heap_number = Add<HLoadNamedField>(object, HInstruction* heap_number = Add<HLoadNamedField>(checked_object,
heap_number_access); heap_number_access);
heap_number->set_type(HType::HeapNumber()); heap_number->set_type(HType::HeapNumber());
instr = New<HStoreNamedField>(heap_number, instr = New<HStoreNamedField>(heap_number,
...@@ -4508,7 +4509,7 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField( ...@@ -4508,7 +4509,7 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField(
} }
} else { } else {
// This is a normal store. // This is a normal store.
instr = New<HStoreNamedField>(object, field_access, value); instr = New<HStoreNamedField>(checked_object, field_access, value);
} }
if (transition_to_field) { if (transition_to_field) {
...@@ -4545,8 +4546,8 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedMonomorphic( ...@@ -4545,8 +4546,8 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedMonomorphic(
// Handle a store to a known field. // Handle a store to a known field.
LookupResult lookup(isolate()); LookupResult lookup(isolate());
if (ComputeLoadStoreField(map, name, &lookup, true)) { if (ComputeLoadStoreField(map, name, &lookup, true)) {
AddCheckMap(object, map); HCheckMaps* checked_object = AddCheckMap(object, map);
return BuildStoreNamedField(object, name, value, map, &lookup); return BuildStoreNamedField(checked_object, name, value, map, &lookup);
} }
// No luck, do a generic store. // No luck, do a generic store.
...@@ -4808,11 +4809,11 @@ bool HOptimizedGraphBuilder::TryStorePolymorphicAsMonomorphic( ...@@ -4808,11 +4809,11 @@ bool HOptimizedGraphBuilder::TryStorePolymorphicAsMonomorphic(
// Everything matched; can use monomorphic store. // Everything matched; can use monomorphic store.
BuildCheckHeapObject(object); BuildCheckHeapObject(object);
Add<HCheckMaps>(object, types); HCheckMaps* checked_object = Add<HCheckMaps>(object, types);
HInstruction* store; HInstruction* store;
CHECK_ALIVE_OR_RETURN( CHECK_ALIVE_OR_RETURN(
store = BuildStoreNamedField( store = BuildStoreNamedField(
object, name, store_value, types->at(count - 1), &lookup), checked_object, name, store_value, types->at(count - 1), &lookup),
true); true);
if (!ast_context()->IsEffect()) Push(result_value); if (!ast_context()->IsEffect()) Push(result_value);
store->set_position(position); store->set_position(position);
...@@ -4861,7 +4862,7 @@ void HOptimizedGraphBuilder::HandlePolymorphicStoreNamedField( ...@@ -4861,7 +4862,7 @@ void HOptimizedGraphBuilder::HandlePolymorphicStoreNamedField(
set_current_block(if_true); set_current_block(if_true);
HInstruction* instr; HInstruction* instr;
CHECK_ALIVE(instr = BuildStoreNamedField( CHECK_ALIVE(instr = BuildStoreNamedField(
object, name, store_value, map, &lookup)); compare, name, store_value, map, &lookup));
instr->set_position(position); instr->set_position(position);
// Goto will add the HSimulate for the store. // Goto will add the HSimulate for the store.
AddInstruction(instr); AddInstruction(instr);
......
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