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
This commit is contained in:
verwaest@chromium.org 2013-08-23 16:31:31 +00:00
parent 885c88e4d5
commit 3837ef57d0
3 changed files with 13 additions and 19 deletions

View File

@ -212,14 +212,8 @@ void HEscapeAnalysisPhase::AnalyzeDataFlow(HInstruction* allocate) {
if (mapcheck->value() != allocate) continue;
// TODO(mstarzinger): This approach breaks if the tracked map value
// is not a HConstant. Find a repro test case and fix this.
for (HUseIterator it(mapcheck->uses()); !it.Done(); it.Advance()) {
if (!it.value()->IsLoadNamedField()) continue;
HLoadNamedField* load = HLoadNamedField::cast(it.value());
load->ClearTypeCheck();
}
ASSERT(mapcheck->HasNoUses());
mapcheck->DeleteAndReplaceWith(NULL);
ASSERT(mapcheck->ActualValue() == allocate);
mapcheck->DeleteAndReplaceWith(mapcheck->ActualValue());
break;
}
default:

View File

@ -5599,7 +5599,6 @@ class HLoadNamedField V8_FINAL : public HTemplateInstruction<1> {
HValue* object() { return OperandAt(0); }
bool HasTypeCheck() { return object()->IsCheckMaps(); }
void ClearTypeCheck() { SetOperandAt(0, object()->ActualValue()); }
HObjectAccess access() const { return access_; }
Representation field_representation() const {
return access_.representation();

View File

@ -4443,7 +4443,7 @@ HCheckMaps* HOptimizedGraphBuilder::AddCheckMap(HValue* object,
HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField(
HValue* object,
HValue* checked_object,
Handle<String> name,
HValue* value,
Handle<Map> map,
@ -4495,11 +4495,12 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField(
AddStoreMapConstant(heap_number, isolate()->factory()->heap_number_map());
Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(),
value);
instr = New<HStoreNamedField>(object, heap_number_access,
heap_number);
instr = New<HStoreNamedField>(checked_object,
heap_number_access,
heap_number);
} else {
// 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->set_type(HType::HeapNumber());
instr = New<HStoreNamedField>(heap_number,
@ -4508,7 +4509,7 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField(
}
} else {
// This is a normal store.
instr = New<HStoreNamedField>(object, field_access, value);
instr = New<HStoreNamedField>(checked_object, field_access, value);
}
if (transition_to_field) {
@ -4545,8 +4546,8 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedMonomorphic(
// Handle a store to a known field.
LookupResult lookup(isolate());
if (ComputeLoadStoreField(map, name, &lookup, true)) {
AddCheckMap(object, map);
return BuildStoreNamedField(object, name, value, map, &lookup);
HCheckMaps* checked_object = AddCheckMap(object, map);
return BuildStoreNamedField(checked_object, name, value, map, &lookup);
}
// No luck, do a generic store.
@ -4808,11 +4809,11 @@ bool HOptimizedGraphBuilder::TryStorePolymorphicAsMonomorphic(
// Everything matched; can use monomorphic store.
BuildCheckHeapObject(object);
Add<HCheckMaps>(object, types);
HCheckMaps* checked_object = Add<HCheckMaps>(object, types);
HInstruction* store;
CHECK_ALIVE_OR_RETURN(
store = BuildStoreNamedField(
object, name, store_value, types->at(count - 1), &lookup),
checked_object, name, store_value, types->at(count - 1), &lookup),
true);
if (!ast_context()->IsEffect()) Push(result_value);
store->set_position(position);
@ -4861,7 +4862,7 @@ void HOptimizedGraphBuilder::HandlePolymorphicStoreNamedField(
set_current_block(if_true);
HInstruction* instr;
CHECK_ALIVE(instr = BuildStoreNamedField(
object, name, store_value, map, &lookup));
compare, name, store_value, map, &lookup));
instr->set_position(position);
// Goto will add the HSimulate for the store.
AddInstruction(instr);