Reviewers: alexandre.rames,

Description:
A64: Fix NumberTagI for cases calling runtime

Avoid need to preserve FP double scratch register across CallRuntime in
NumberTagI deferred code.

BUG=none

Please review this at https://codereview.chromium.org/146693002/

SVN Base: https://v8.googlecode.com/svn/branches/experimental/a64

Affected files (+14, -15 lines):
  M src/a64/lithium-a64.cc
  M src/a64/lithium-codegen-a64.cc


Index: src/a64/lithium-a64.cc
diff --git a/src/a64/lithium-a64.cc b/src/a64/lithium-a64.cc
index c0b6309289752d0c2ab38acadbc846fa0c3ea530..11cf0d138b1f4127cde22a41eb3bd941ef508347 100644
--- a/src/a64/lithium-a64.cc
+++ b/src/a64/lithium-a64.cc
@@ -1133,9 +1133,9 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
     info()->MarkAsDeferredCalling();
     if (to.IsTagged()) {
       HValue* val = instr->value();
-      LOperand* value = UseRegisterAtStart(val);

       if (val->CheckFlag(HInstruction::kUint32)) {
+        LOperand* value = UseRegister(val);
         LNumberTagU* result = new(zone()) LNumberTagU(value,
                                                       TempRegister(),
                                                       TempRegister());
@@ -1143,6 +1143,7 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
       } else {
         STATIC_ASSERT((kMinInt == Smi::kMinValue) &&
                       (kMaxInt == Smi::kMaxValue));
+        LOperand* value = UseRegisterAtStart(val);
         return DefineAsRegister(new(zone()) LSmiTag(value));
       }
     } else if (to.IsSmi()) {
Index: src/a64/lithium-codegen-a64.cc
diff --git a/src/a64/lithium-codegen-a64.cc b/src/a64/lithium-codegen-a64.cc
index c730da724586943c5ba8adab516e946649a1bba0..805e536f56dc1a183828348c322cdce9030eb736 100644
--- a/src/a64/lithium-codegen-a64.cc
+++ b/src/a64/lithium-codegen-a64.cc
@@ -3997,24 +3997,15 @@ void LCodeGen::DoDeferredNumberTagI(LInstruction* instr,
                                     LOperand* temp1,
                                     LOperand* temp2,
                                     IntegerSignedness signedness) {
-  Label slow;
+  Label slow, convert_and_store;
   Register src = ToRegister32(value);
   Register dst = ToRegister(instr->result());
-  DoubleRegister dbl_scratch = double_scratch();
-
-  Label done;
-  if (signedness == SIGNED_INT32) {
-    ASM_UNIMPLEMENTED_BREAK("DeferredNumberTagI - signed int32 case.");
-  } else {
-    ASSERT(signedness == UNSIGNED_INT32);
-    __ Ucvtf(dbl_scratch, src);
-  }
-
   Register scratch1 = ToRegister(temp1);
+
   if (FLAG_inline_new) {
     Register scratch2 = ToRegister(temp2);
     __ AllocateHeapNumber(dst, &slow, scratch1, scratch2);
-    __ B(&done);
+    __ B(&convert_and_store);
   }

   // Slow case: call the runtime system to do the number allocation.
@@ -4039,9 +4030,16 @@ void LCodeGen::DoDeferredNumberTagI(LInstruction* instr,
     __ StoreToSafepointRegisterSlot(x0, dst);
   }

- // Done. Move converted value in dbl_scratch into the newly allocated heap
+  // Convert number to floating point and store in the newly allocated heap
   // number.
-  __ Bind(&done);
+  __ Bind(&convert_and_store);
+  DoubleRegister dbl_scratch = double_scratch();
+  if (signedness == SIGNED_INT32) {
+    ASM_UNIMPLEMENTED_BREAK("DeferredNumberTagI - signed int32 case.");
+  } else {
+    ASSERT(signedness == UNSIGNED_INT32);
+    __ Ucvtf(dbl_scratch, src);
+  }
   __ Str(dbl_scratch, FieldMemOperand(dst, HeapNumber::kValueOffset));
 }



--
--
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/groups/opt_out.

Reply via email to