From 5dea882447025b14d014918bed40c78a5db02795 Mon Sep 17 00:00:00 2001 From: "feng@chromium.org" Date: Thu, 20 Nov 2008 16:31:22 +0000 Subject: [PATCH] Minor cleanup code in GenerateStoreField. Review URL: http://codereview.chromium.org/11276 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@806 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/stub-cache-ia32.cc | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/stub-cache-ia32.cc b/src/stub-cache-ia32.cc index d15b19d..c2be65d 100644 --- a/src/stub-cache-ia32.cc +++ b/src/stub-cache-ia32.cc @@ -401,16 +401,6 @@ void StubCompiler::GenerateStoreField(MacroAssembler* masm, return; } - // 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(); - - if (index >= 0) { - // Get the properties array (optimistically). - __ mov(scratch, FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); - } - if (transition != NULL) { // Update the map of the object; no write barrier updating is // needed because the map is never in new space. @@ -418,6 +408,11 @@ void StubCompiler::GenerateStoreField(MacroAssembler* masm, Immediate(Handle(transition))); } + // 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(); + if (index < 0) { // Set the property straight into the object. int offset = object->map()->instance_size() + (index * kPointerSize); @@ -430,6 +425,8 @@ void StubCompiler::GenerateStoreField(MacroAssembler* masm, } else { // Write to the properties array. int offset = index * kPointerSize + Array::kHeaderSize; + // Get the properties array (optimistically). + __ mov(scratch, FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); __ mov(FieldOperand(scratch, offset), eax); // Update the write barrier for the array address. -- 2.7.4