Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3047)

Unified Diff: src/stub-cache-ia32.cc

Issue 7431: Addressed review comment by Kasper:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/stub-cache-arm.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/stub-cache-ia32.cc
===================================================================
--- src/stub-cache-ia32.cc (revision 506)
+++ src/stub-cache-ia32.cc (working copy)
@@ -238,6 +238,27 @@
}
+// Load a fast property out of a holder object (src). In-object properties
+// are loaded directly otherwise the property is loaded from the properties
+// fixed array.
+void StubCompiler::GenerateFastPropertyLoad(MacroAssembler* masm,
+ Register dst, Register src,
+ JSObject* holder, int index) {
+ // Adjust for the number of properties stored in the holder.
+ index -= holder->map()->inobject_properties();
+ if (index < 0) {
+ // Get the property straight out of the holder.
+ int offset = holder->map()->instance_size() + (index * kPointerSize);
+ __ mov(dst, FieldOperand(src, offset));
+ } else {
+ // Calculate the offset into the properties array.
+ int offset = index * kPointerSize + Array::kHeaderSize;
+ __ mov(dst, FieldOperand(src, JSObject::kPropertiesOffset));
+ __ mov(dst, FieldOperand(dst, offset));
+ }
+}
+
+
void StubCompiler::GenerateLoadField(MacroAssembler* masm,
JSObject* object,
JSObject* holder,
@@ -254,19 +275,8 @@
Register reg =
__ CheckMaps(object, receiver, holder, scratch1, scratch2, miss_label);
- // Adjust for the number of properties stored in the holder.
- index -= holder->map()->inobject_properties();
- if (index < 0) {
- // Get the property straight out of the holder.
- int offset = holder->map()->instance_size() + (index * kPointerSize);
- __ mov(eax, FieldOperand(reg, offset));
- } else {
- // Get the properties array of the holder.
- __ mov(scratch1, FieldOperand(reg, JSObject::kPropertiesOffset));
- // Return the value from the properties array.
- int offset = index * kPointerSize + Array::kHeaderSize;
- __ mov(eax, FieldOperand(scratch1, offset));
- }
+ // Get the value from the properties.
+ GenerateFastPropertyLoad(masm, eax, reg, holder, index);
__ ret(0);
}
@@ -499,19 +509,7 @@
Register reg =
__ CheckMaps(JSObject::cast(object), edx, holder, ebx, ecx, &miss);
- // Adjust for the number of properties stored in the holder.
- index -= holder->map()->inobject_properties();
- if (index < 0) {
- // Get the property straight out of the holder.
- int offset = holder->map()->instance_size() + (index * kPointerSize);
- __ mov(edi, FieldOperand(reg, offset));
- } else {
- // Get the properties array of the holder and get the function from
- // the field.
- int offset = index * kPointerSize + Array::kHeaderSize;
- __ mov(edi, FieldOperand(reg, JSObject::kPropertiesOffset));
- __ mov(edi, FieldOperand(edi, offset));
- }
+ GenerateFastPropertyLoad(masm(), edi, reg, holder, index);
// Check that the function really is a function.
__ test(edi, Immediate(kSmiTagMask));
« no previous file with comments | « src/stub-cache-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698