Revision: 22940
Author:   [email protected]
Date:     Wed Aug  6 15:11:09 2014 UTC
Log:      MIPS: Always use the StoreFieldStub to do the actual storing.

Port r22931 (2af0a29f)

BUG=
[email protected]

Review URL: https://codereview.chromium.org/440423004
http://code.google.com/p/v8/source/detail?r=22940

Modified:
 /branches/bleeding_edge/src/mips/stub-cache-mips.cc
 /branches/bleeding_edge/src/mips64/stub-cache-mips64.cc

=======================================
--- /branches/bleeding_edge/src/mips/stub-cache-mips.cc Wed Aug 6 13:17:33 2014 UTC +++ /branches/bleeding_edge/src/mips/stub-cache-mips.cc Wed Aug 6 15:11:09 2014 UTC
@@ -576,80 +576,30 @@
 }


-// Generate StoreField code, value is passed in a0 register.
-// When leaving generated code after success, the receiver_reg and name_reg
-// may be clobbered.  Upon branch to miss_label, the receiver and name
-// registers have their original values.
-void NamedStoreHandlerCompiler::GenerateStoreField(
-    Handle<JSObject> object, LookupResult* lookup, Register receiver_reg,
- Register name_reg, Register value_reg, Register scratch1, Register scratch2,
-    Label* miss_label) {
-  // a0 : value
-  Label exit;
-
-  // Stub never generated for objects that require access checks.
-  DCHECK(!object->IsAccessCheckNeeded());
-  DCHECK(!object->IsJSGlobalProxy());
-
-  FieldIndex index = lookup->GetFieldIndex();
-
+void NamedStoreHandlerCompiler::GenerateStoreField(LookupResult* lookup,
+                                                   Register value_reg,
+                                                   Label* miss_label) {
   DCHECK(lookup->representation().IsHeapObject());
   __ JumpIfSmi(value_reg, miss_label);
-  HeapType* field_type = lookup->GetFieldType();
-  HeapType::Iterator<Map> it = field_type->Classes();
-  if (!it.Done()) {
-    __ lw(scratch1, FieldMemOperand(value_reg, HeapObject::kMapOffset));
-    Label do_store;
-    Handle<Map> current;
-    while (true) {
-      // Do the CompareMap() directly within the Branch() functions.
-      current = it.Current();
-      it.Advance();
-      if (it.Done()) {
-        __ Branch(miss_label, ne, scratch1, Operand(current));
-        break;
-      }
-      __ Branch(&do_store, eq, scratch1, Operand(current));
+  HeapType::Iterator<Map> it = lookup->GetFieldType()->Classes();
+  __ lw(scratch1(), FieldMemOperand(value_reg, HeapObject::kMapOffset));
+  Label do_store;
+  Handle<Map> current;
+  while (true) {
+    // Do the CompareMap() directly within the Branch() functions.
+    current = it.Current();
+    it.Advance();
+    if (it.Done()) {
+      __ Branch(miss_label, ne, scratch1(), Operand(current));
+      break;
     }
-    __ bind(&do_store);
+    __ Branch(&do_store, eq, scratch1(), Operand(current));
   }
+  __ bind(&do_store);

-  if (index.is_inobject()) {
-    // Set the property straight into the object.
-    __ sw(value_reg, FieldMemOperand(receiver_reg, index.offset()));
-
-    // Skip updating write barrier if storing a smi.
-    __ JumpIfSmi(value_reg, &exit);
-
-    // Update the write barrier for the array address.
-    // Pass the now unused name_reg as a scratch register.
-    __ mov(name_reg, value_reg);
-    __ RecordWriteField(receiver_reg, index.offset(), name_reg, scratch1,
-                        kRAHasNotBeenSaved, kDontSaveFPRegs,
-                        EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
-  } else {
-    // Write to the properties array.
-    // Get the properties array.
-    __ lw(scratch1,
-          FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset));
-    __ sw(value_reg, FieldMemOperand(scratch1, index.offset()));
-
-    // Skip updating write barrier if storing a smi.
-    __ JumpIfSmi(value_reg, &exit);
-
-    // Update the write barrier for the array address.
-    // Ok to clobber receiver_reg and name_reg, since we return.
-    __ mov(name_reg, value_reg);
-    __ RecordWriteField(scratch1, index.offset(), name_reg, receiver_reg,
-                        kRAHasNotBeenSaved, kDontSaveFPRegs,
-                        EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
-  }
-
-  // Return the value (register v0).
-  DCHECK(value_reg.is(a0));
-  __ bind(&exit);
-  __ Ret(USE_DELAY_SLOT);
-  __ mov(v0, a0);
+  StoreFieldStub stub(isolate(), lookup->GetFieldIndex(),
+                      lookup->representation());
+  GenerateTailCall(masm(), stub.GetCode());
 }


=======================================
--- /branches/bleeding_edge/src/mips64/stub-cache-mips64.cc Wed Aug 6 13:17:33 2014 UTC +++ /branches/bleeding_edge/src/mips64/stub-cache-mips64.cc Wed Aug 6 15:11:09 2014 UTC
@@ -580,80 +580,30 @@
 }


-// Generate StoreField code, value is passed in a0 register.
-// When leaving generated code after success, the receiver_reg and name_reg
-// may be clobbered.  Upon branch to miss_label, the receiver and name
-// registers have their original values.
-void NamedStoreHandlerCompiler::GenerateStoreField(
-    Handle<JSObject> object, LookupResult* lookup, Register receiver_reg,
- Register name_reg, Register value_reg, Register scratch1, Register scratch2,
-    Label* miss_label) {
-  // a0 : value
-  Label exit;
-
-  // Stub never generated for objects that require access checks.
-  DCHECK(!object->IsAccessCheckNeeded());
-  DCHECK(!object->IsJSGlobalProxy());
-
-  FieldIndex index = lookup->GetFieldIndex();
-
+void NamedStoreHandlerCompiler::GenerateStoreField(LookupResult* lookup,
+                                                   Register value_reg,
+                                                   Label* miss_label) {
   DCHECK(lookup->representation().IsHeapObject());
   __ JumpIfSmi(value_reg, miss_label);
-  HeapType* field_type = lookup->GetFieldType();
-  HeapType::Iterator<Map> it = field_type->Classes();
-  if (!it.Done()) {
-    __ ld(scratch1, FieldMemOperand(value_reg, HeapObject::kMapOffset));
-    Label do_store;
-    Handle<Map> current;
-    while (true) {
-      // Do the CompareMap() directly within the Branch() functions.
-      current = it.Current();
-      it.Advance();
-      if (it.Done()) {
-        __ Branch(miss_label, ne, scratch1, Operand(current));
-        break;
-      }
-      __ Branch(&do_store, eq, scratch1, Operand(current));
+  HeapType::Iterator<Map> it = lookup->GetFieldType()->Classes();
+  __ ld(scratch1(), FieldMemOperand(value_reg, HeapObject::kMapOffset));
+  Label do_store;
+  Handle<Map> current;
+  while (true) {
+    // Do the CompareMap() directly within the Branch() functions.
+    current = it.Current();
+    it.Advance();
+    if (it.Done()) {
+      __ Branch(miss_label, ne, scratch1(), Operand(current));
+      break;
     }
-    __ bind(&do_store);
+    __ Branch(&do_store, eq, scratch1(), Operand(current));
   }
+  __ bind(&do_store);

-  if (index.is_inobject()) {
-    // Set the property straight into the object.
-    __ sd(value_reg, FieldMemOperand(receiver_reg, index.offset()));
-
-    // Skip updating write barrier if storing a smi.
-    __ JumpIfSmi(value_reg, &exit);
-
-    // Update the write barrier for the array address.
-    // Pass the now unused name_reg as a scratch register.
-    __ mov(name_reg, value_reg);
-    __ RecordWriteField(receiver_reg, index.offset(), name_reg, scratch1,
-                        kRAHasNotBeenSaved, kDontSaveFPRegs,
-                        EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
-  } else {
-    // Write to the properties array.
-    // Get the properties array.
-    __ ld(scratch1,
-          FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset));
-    __ sd(value_reg, FieldMemOperand(scratch1, index.offset()));
-
-    // Skip updating write barrier if storing a smi.
-    __ JumpIfSmi(value_reg, &exit);
-
-    // Update the write barrier for the array address.
-    // Ok to clobber receiver_reg and name_reg, since we return.
-    __ mov(name_reg, value_reg);
-    __ RecordWriteField(scratch1, index.offset(), name_reg, receiver_reg,
-                        kRAHasNotBeenSaved, kDontSaveFPRegs,
-                        EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
-  }
-
-  // Return the value (register v0).
-  DCHECK(value_reg.is(a0));
-  __ bind(&exit);
-  __ Ret(USE_DELAY_SLOT);
-  __ mov(v0, a0);
+  StoreFieldStub stub(isolate(), lookup->GetFieldIndex(),
+                      lookup->representation());
+  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.

Reply via email to