Commit 313939a9 authored by akos.palfi@imgtec.com's avatar akos.palfi@imgtec.com

MIPS: Hydrogenize (and share) StoreField except heapobject (for now).

Port r22909 (df25caa5)

BUG=
R=gergely.kis@imgtec.com

Review URL: https://codereview.chromium.org/447673003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22930 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent f374ee63
...@@ -593,85 +593,40 @@ void NamedStoreHandlerCompiler::GenerateStoreField( ...@@ -593,85 +593,40 @@ void NamedStoreHandlerCompiler::GenerateStoreField(
FieldIndex index = lookup->GetFieldIndex(); FieldIndex index = lookup->GetFieldIndex();
Representation representation = lookup->representation(); DCHECK(lookup->representation().IsHeapObject());
DCHECK(!representation.IsNone()); __ JumpIfSmi(value_reg, miss_label);
if (representation.IsSmi()) { HeapType* field_type = lookup->GetFieldType();
__ JumpIfNotSmi(value_reg, miss_label); HeapType::Iterator<Map> it = field_type->Classes();
} else if (representation.IsHeapObject()) { if (!it.Done()) {
__ JumpIfSmi(value_reg, miss_label); __ lw(scratch1, FieldMemOperand(value_reg, HeapObject::kMapOffset));
HeapType* field_type = lookup->GetFieldType(); Label do_store;
HeapType::Iterator<Map> it = field_type->Classes(); Handle<Map> current;
if (!it.Done()) { while (true) {
__ lw(scratch1, FieldMemOperand(value_reg, HeapObject::kMapOffset)); // Do the CompareMap() directly within the Branch() functions.
Label do_store; current = it.Current();
Handle<Map> current; it.Advance();
while (true) { if (it.Done()) {
// Do the CompareMap() directly within the Branch() functions. __ Branch(miss_label, ne, scratch1, Operand(current));
current = it.Current(); break;
it.Advance();
if (it.Done()) {
__ Branch(miss_label, ne, scratch1, Operand(current));
break;
}
__ Branch(&do_store, eq, scratch1, Operand(current));
} }
__ bind(&do_store); __ Branch(&do_store, eq, scratch1, Operand(current));
}
} else if (representation.IsDouble()) {
// Load the double storage.
if (index.is_inobject()) {
__ lw(scratch1, FieldMemOperand(receiver_reg, index.offset()));
} else {
__ lw(scratch1,
FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset));
__ lw(scratch1, FieldMemOperand(scratch1, index.offset()));
} }
// Store the value into the storage.
Label do_store, heap_number;
__ JumpIfNotSmi(value_reg, &heap_number);
__ SmiUntag(scratch2, value_reg);
__ mtc1(scratch2, f6);
__ cvt_d_w(f4, f6);
__ jmp(&do_store);
__ bind(&heap_number);
__ CheckMap(value_reg, scratch2, Heap::kHeapNumberMapRootIndex,
miss_label, DONT_DO_SMI_CHECK);
__ ldc1(f4, FieldMemOperand(value_reg, HeapNumber::kValueOffset));
__ bind(&do_store); __ bind(&do_store);
__ sdc1(f4, FieldMemOperand(scratch1, HeapNumber::kValueOffset));
// Return the value (register v0).
DCHECK(value_reg.is(a0));
__ Ret(USE_DELAY_SLOT);
__ mov(v0, a0);
return;
} }
// TODO(verwaest): Share this code as a code stub.
SmiCheck smi_check = representation.IsTagged()
? INLINE_SMI_CHECK : OMIT_SMI_CHECK;
if (index.is_inobject()) { if (index.is_inobject()) {
// Set the property straight into the object. // Set the property straight into the object.
__ sw(value_reg, FieldMemOperand(receiver_reg, index.offset())); __ sw(value_reg, FieldMemOperand(receiver_reg, index.offset()));
if (!representation.IsSmi()) { // Skip updating write barrier if storing a smi.
// Skip updating write barrier if storing a smi. __ JumpIfSmi(value_reg, &exit);
__ JumpIfSmi(value_reg, &exit);
// Update the write barrier for the array address. // Update the write barrier for the array address.
// Pass the now unused name_reg as a scratch register. // Pass the now unused name_reg as a scratch register.
__ mov(name_reg, value_reg); __ mov(name_reg, value_reg);
__ RecordWriteField(receiver_reg, __ RecordWriteField(receiver_reg, index.offset(), name_reg, scratch1,
index.offset(), kRAHasNotBeenSaved, kDontSaveFPRegs,
name_reg, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
scratch1,
kRAHasNotBeenSaved,
kDontSaveFPRegs,
EMIT_REMEMBERED_SET,
smi_check);
}
} else { } else {
// Write to the properties array. // Write to the properties array.
// Get the properties array. // Get the properties array.
...@@ -679,22 +634,15 @@ void NamedStoreHandlerCompiler::GenerateStoreField( ...@@ -679,22 +634,15 @@ void NamedStoreHandlerCompiler::GenerateStoreField(
FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset));
__ sw(value_reg, FieldMemOperand(scratch1, index.offset())); __ sw(value_reg, FieldMemOperand(scratch1, index.offset()));
if (!representation.IsSmi()) { // Skip updating write barrier if storing a smi.
// Skip updating write barrier if storing a smi. __ JumpIfSmi(value_reg, &exit);
__ JumpIfSmi(value_reg, &exit);
// Update the write barrier for the array address. // Update the write barrier for the array address.
// Ok to clobber receiver_reg and name_reg, since we return. // Ok to clobber receiver_reg and name_reg, since we return.
__ mov(name_reg, value_reg); __ mov(name_reg, value_reg);
__ RecordWriteField(scratch1, __ RecordWriteField(scratch1, index.offset(), name_reg, receiver_reg,
index.offset(), kRAHasNotBeenSaved, kDontSaveFPRegs,
name_reg, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
receiver_reg,
kRAHasNotBeenSaved,
kDontSaveFPRegs,
EMIT_REMEMBERED_SET,
smi_check);
}
} }
// Return the value (register v0). // Return the value (register v0).
......
...@@ -597,85 +597,40 @@ void NamedStoreHandlerCompiler::GenerateStoreField( ...@@ -597,85 +597,40 @@ void NamedStoreHandlerCompiler::GenerateStoreField(
FieldIndex index = lookup->GetFieldIndex(); FieldIndex index = lookup->GetFieldIndex();
Representation representation = lookup->representation(); DCHECK(lookup->representation().IsHeapObject());
DCHECK(!representation.IsNone()); __ JumpIfSmi(value_reg, miss_label);
if (representation.IsSmi()) { HeapType* field_type = lookup->GetFieldType();
__ JumpIfNotSmi(value_reg, miss_label); HeapType::Iterator<Map> it = field_type->Classes();
} else if (representation.IsHeapObject()) { if (!it.Done()) {
__ JumpIfSmi(value_reg, miss_label); __ ld(scratch1, FieldMemOperand(value_reg, HeapObject::kMapOffset));
HeapType* field_type = lookup->GetFieldType(); Label do_store;
HeapType::Iterator<Map> it = field_type->Classes(); Handle<Map> current;
if (!it.Done()) { while (true) {
__ ld(scratch1, FieldMemOperand(value_reg, HeapObject::kMapOffset)); // Do the CompareMap() directly within the Branch() functions.
Label do_store; current = it.Current();
Handle<Map> current; it.Advance();
while (true) { if (it.Done()) {
// Do the CompareMap() directly within the Branch() functions. __ Branch(miss_label, ne, scratch1, Operand(current));
current = it.Current(); break;
it.Advance();
if (it.Done()) {
__ Branch(miss_label, ne, scratch1, Operand(current));
break;
}
__ Branch(&do_store, eq, scratch1, Operand(current));
} }
__ bind(&do_store); __ Branch(&do_store, eq, scratch1, Operand(current));
}
} else if (representation.IsDouble()) {
// Load the double storage.
if (index.is_inobject()) {
__ ld(scratch1, FieldMemOperand(receiver_reg, index.offset()));
} else {
__ ld(scratch1,
FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset));
__ ld(scratch1, FieldMemOperand(scratch1, index.offset()));
} }
// Store the value into the storage.
Label do_store, heap_number;
__ JumpIfNotSmi(value_reg, &heap_number);
__ SmiUntag(scratch2, value_reg);
__ mtc1(scratch2, f6);
__ cvt_d_w(f4, f6);
__ jmp(&do_store);
__ bind(&heap_number);
__ CheckMap(value_reg, scratch2, Heap::kHeapNumberMapRootIndex,
miss_label, DONT_DO_SMI_CHECK);
__ ldc1(f4, FieldMemOperand(value_reg, HeapNumber::kValueOffset));
__ bind(&do_store); __ bind(&do_store);
__ sdc1(f4, FieldMemOperand(scratch1, HeapNumber::kValueOffset));
// Return the value (register v0).
DCHECK(value_reg.is(a0));
__ Ret(USE_DELAY_SLOT);
__ mov(v0, a0);
return;
} }
// TODO(verwaest): Share this code as a code stub.
SmiCheck smi_check = representation.IsTagged()
? INLINE_SMI_CHECK : OMIT_SMI_CHECK;
if (index.is_inobject()) { if (index.is_inobject()) {
// Set the property straight into the object. // Set the property straight into the object.
__ sd(value_reg, FieldMemOperand(receiver_reg, index.offset())); __ sd(value_reg, FieldMemOperand(receiver_reg, index.offset()));
if (!representation.IsSmi()) { // Skip updating write barrier if storing a smi.
// Skip updating write barrier if storing a smi. __ JumpIfSmi(value_reg, &exit);
__ JumpIfSmi(value_reg, &exit);
// Update the write barrier for the array address. // Update the write barrier for the array address.
// Pass the now unused name_reg as a scratch register. // Pass the now unused name_reg as a scratch register.
__ mov(name_reg, value_reg); __ mov(name_reg, value_reg);
__ RecordWriteField(receiver_reg, __ RecordWriteField(receiver_reg, index.offset(), name_reg, scratch1,
index.offset(), kRAHasNotBeenSaved, kDontSaveFPRegs,
name_reg, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
scratch1,
kRAHasNotBeenSaved,
kDontSaveFPRegs,
EMIT_REMEMBERED_SET,
smi_check);
}
} else { } else {
// Write to the properties array. // Write to the properties array.
// Get the properties array. // Get the properties array.
...@@ -683,22 +638,15 @@ void NamedStoreHandlerCompiler::GenerateStoreField( ...@@ -683,22 +638,15 @@ void NamedStoreHandlerCompiler::GenerateStoreField(
FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset));
__ sd(value_reg, FieldMemOperand(scratch1, index.offset())); __ sd(value_reg, FieldMemOperand(scratch1, index.offset()));
if (!representation.IsSmi()) { // Skip updating write barrier if storing a smi.
// Skip updating write barrier if storing a smi. __ JumpIfSmi(value_reg, &exit);
__ JumpIfSmi(value_reg, &exit);
// Update the write barrier for the array address. // Update the write barrier for the array address.
// Ok to clobber receiver_reg and name_reg, since we return. // Ok to clobber receiver_reg and name_reg, since we return.
__ mov(name_reg, value_reg); __ mov(name_reg, value_reg);
__ RecordWriteField(scratch1, __ RecordWriteField(scratch1, index.offset(), name_reg, receiver_reg,
index.offset(), kRAHasNotBeenSaved, kDontSaveFPRegs,
name_reg, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
receiver_reg,
kRAHasNotBeenSaved,
kDontSaveFPRegs,
EMIT_REMEMBERED_SET,
smi_check);
}
} }
// Return the value (register v0). // Return the value (register v0).
......
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