Revision: 21722
Author: [email protected]
Date: Fri Jun 6 15:43:19 2014 UTC
Log: MIPS: Introduce FieldIndex to unify and abstract property/field
offset.
Port r21720 (aeb7bef)
BUG=
[email protected]
Review URL: https://codereview.chromium.org/314333003
Patch from Balazs Kilvady <[email protected]>.
http://code.google.com/p/v8/source/detail?r=21722
Modified:
/branches/bleeding_edge/src/mips/stub-cache-mips.cc
=======================================
--- /branches/bleeding_edge/src/mips/stub-cache-mips.cc Tue Jun 3 08:12:43
2014 UTC
+++ /branches/bleeding_edge/src/mips/stub-cache-mips.cc Fri Jun 6 15:43:19
2014 UTC
@@ -561,12 +561,7 @@
// checks.
ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded());
- int index = lookup->GetFieldIndex().field_index();
-
- // Adjust for the number of properties stored in the object. Even in the
- // face of a transition we can use the old map here because the size of
the
- // object and the number of in-object properties is not going to change.
- index -= object->map()->inobject_properties();
+ FieldIndex index = lookup->GetFieldIndex();
Representation representation = lookup->representation();
ASSERT(!representation.IsNone());
@@ -594,14 +589,12 @@
}
} else if (representation.IsDouble()) {
// Load the double storage.
- if (index < 0) {
- int offset = object->map()->instance_size() + (index * kPointerSize);
- __ lw(scratch1, FieldMemOperand(receiver_reg, offset));
+ if (index.is_inobject()) {
+ __ lw(scratch1, FieldMemOperand(receiver_reg, index.offset()));
} else {
__ lw(scratch1,
FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset));
- int offset = index * kPointerSize + FixedArray::kHeaderSize;
- __ lw(scratch1, FieldMemOperand(scratch1, offset));
+ __ lw(scratch1, FieldMemOperand(scratch1, index.offset()));
}
// Store the value into the storage.
@@ -629,10 +622,9 @@
// TODO(verwaest): Share this code as a code stub.
SmiCheck smi_check = representation.IsTagged()
? INLINE_SMI_CHECK : OMIT_SMI_CHECK;
- if (index < 0) {
+ if (index.is_inobject()) {
// Set the property straight into the object.
- int offset = object->map()->instance_size() + (index * kPointerSize);
- __ sw(value_reg, FieldMemOperand(receiver_reg, offset));
+ __ sw(value_reg, FieldMemOperand(receiver_reg, index.offset()));
if (!representation.IsSmi()) {
// Skip updating write barrier if storing a smi.
@@ -642,7 +634,7 @@
// Pass the now unused name_reg as a scratch register.
__ mov(name_reg, value_reg);
__ RecordWriteField(receiver_reg,
- offset,
+ index.offset(),
name_reg,
scratch1,
kRAHasNotBeenSaved,
@@ -652,11 +644,10 @@
}
} else {
// Write to the properties array.
- int offset = index * kPointerSize + FixedArray::kHeaderSize;
// Get the properties array.
__ lw(scratch1,
FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset));
- __ sw(value_reg, FieldMemOperand(scratch1, offset));
+ __ sw(value_reg, FieldMemOperand(scratch1, index.offset()));
if (!representation.IsSmi()) {
// Skip updating write barrier if storing a smi.
@@ -666,7 +657,7 @@
// Ok to clobber receiver_reg and name_reg, since we return.
__ mov(name_reg, value_reg);
__ RecordWriteField(scratch1,
- offset,
+ index.offset(),
name_reg,
receiver_reg,
kRAHasNotBeenSaved,
@@ -997,20 +988,14 @@
void LoadStubCompiler::GenerateLoadField(Register reg,
Handle<JSObject> holder,
- PropertyIndex field,
+ FieldIndex field,
Representation representation) {
if (!reg.is(receiver())) __ mov(receiver(), reg);
if (kind() == Code::LOAD_IC) {
- LoadFieldStub stub(isolate(),
- field.is_inobject(holder),
- field.translate(holder),
- representation);
+ LoadFieldStub stub(isolate(), field);
GenerateTailCall(masm(), stub.GetCode());
} else {
- KeyedLoadFieldStub stub(isolate(),
- field.is_inobject(holder),
- field.translate(holder),
- representation);
+ KeyedLoadFieldStub stub(isolate(), field);
GenerateTailCall(masm(), stub.GetCode());
}
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.