Revision: 21476
Author:   [email protected]
Date:     Mon May 26 06:41:21 2014 UTC
Log:      LoadUint32() doesn't need a scratch register.

[email protected]

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

Modified:
 /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc
 /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.h
 /branches/bleeding_edge/src/ia32/lithium-ia32.cc
 /branches/bleeding_edge/src/ia32/lithium-ia32.h
 /branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc
 /branches/bleeding_edge/src/ia32/macro-assembler-ia32.h
 /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc
 /branches/bleeding_edge/src/x64/lithium-x64.cc
 /branches/bleeding_edge/src/x64/lithium-x64.h
 /branches/bleeding_edge/src/x64/macro-assembler-x64.cc
 /branches/bleeding_edge/src/x64/macro-assembler-x64.h

=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Thu May 22 08:37:50 2014 UTC +++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Mon May 26 06:41:21 2014 UTC
@@ -4447,10 +4447,7 @@
 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) {
   LOperand* input = instr->value();
   LOperand* output = instr->result();
-  LOperand* temp = instr->temp();
-  __ LoadUint32(ToDoubleRegister(output),
-                ToRegister(input),
-                ToDoubleRegister(temp));
+  __ LoadUint32(ToDoubleRegister(output), ToRegister(input));
 }


@@ -4461,8 +4458,8 @@
                        LNumberTagI* instr)
         : LDeferredCode(codegen), instr_(instr) { }
     virtual void Generate() V8_OVERRIDE {
- codegen()->DoDeferredNumberTagIU(instr_, instr_->value(), instr_->temp(),
-                                       NULL, SIGNED_INT32);
+      codegen()->DoDeferredNumberTagIU(
+          instr_, instr_->value(), instr_->temp(), SIGNED_INT32);
     }
     virtual LInstruction* instr() V8_OVERRIDE { return instr_; }
    private:
@@ -4487,8 +4484,8 @@
     DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr)
         : LDeferredCode(codegen), instr_(instr) { }
     virtual void Generate() V8_OVERRIDE {
- codegen()->DoDeferredNumberTagIU(instr_, instr_->value(), instr_->temp1(),
-                                       instr_->temp2(), UNSIGNED_INT32);
+      codegen()->DoDeferredNumberTagIU(
+          instr_, instr_->value(), instr_->temp(), UNSIGNED_INT32);
     }
     virtual LInstruction* instr() V8_OVERRIDE { return instr_; }
    private:
@@ -4510,12 +4507,11 @@

 void LCodeGen::DoDeferredNumberTagIU(LInstruction* instr,
                                      LOperand* value,
-                                     LOperand* temp1,
-                                     LOperand* temp2,
+                                     LOperand* temp,
                                      IntegerSignedness signedness) {
   Label done, slow;
   Register reg = ToRegister(value);
-  Register tmp = ToRegister(temp1);
+  Register tmp = ToRegister(temp);
   XMMRegister xmm_scratch = double_scratch0();

   if (signedness == SIGNED_INT32) {
@@ -4526,7 +4522,7 @@
     __ xor_(reg, 0x80000000);
     __ Cvtsi2sd(xmm_scratch, Operand(reg));
   } else {
-    __ LoadUint32(xmm_scratch, reg, ToDoubleRegister(temp2));
+    __ LoadUint32(xmm_scratch, reg);
   }

   if (FLAG_inline_new) {
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.h Thu May 22 08:37:50 2014 UTC +++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.h Mon May 26 06:41:21 2014 UTC
@@ -95,8 +95,7 @@
   enum IntegerSignedness { SIGNED_INT32, UNSIGNED_INT32 };
   void DoDeferredNumberTagIU(LInstruction* instr,
                              LOperand* value,
-                             LOperand* temp1,
-                             LOperand* temp2,
+                             LOperand* temp,
                              IntegerSignedness signedness);

   void DoDeferredTaggedToI(LTaggedToI* instr, Label* done);
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.cc Fri May 23 14:06:42 2014 UTC +++ /branches/bleeding_edge/src/ia32/lithium-ia32.cc Mon May 26 06:41:21 2014 UTC
@@ -1941,17 +1941,14 @@
   } else if (from.IsInteger32()) {
     info()->MarkAsDeferredCalling();
     if (to.IsTagged()) {
+      LOperand* value = UseRegister(val);
       if (!instr->CheckFlag(HValue::kCanOverflow)) {
-        LOperand* value = UseRegister(val);
         return DefineSameAsFirst(new(zone()) LSmiTag(value));
       } else if (val->CheckFlag(HInstruction::kUint32)) {
-        LOperand* value = UseRegister(val);
-        LOperand* temp1 = TempRegister();
-        LOperand* temp2 = FixedTemp(xmm1);
-        LNumberTagU* result = new(zone()) LNumberTagU(value, temp1, temp2);
+        LOperand* temp = TempRegister();
+        LNumberTagU* result = new(zone()) LNumberTagU(value, temp);
         return AssignPointerMap(DefineSameAsFirst(result));
       } else {
-        LOperand* value = UseRegister(val);
         LOperand* temp = TempRegister();
         LNumberTagI* result = new(zone()) LNumberTagI(value, temp);
         return AssignPointerMap(DefineSameAsFirst(result));
@@ -1966,9 +1963,7 @@
     } else {
       ASSERT(to.IsDouble());
       if (val->CheckFlag(HInstruction::kUint32)) {
-        LOperand* temp = FixedTemp(xmm1);
-        return DefineAsRegister(
-            new(zone()) LUint32ToDouble(UseRegister(val), temp));
+ return DefineAsRegister(new(zone()) LUint32ToDouble(UseRegister(val)));
       } else {
         return DefineAsRegister(new(zone()) LInteger32ToDouble(Use(val)));
       }
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.h Fri May 23 13:15:07 2014 UTC +++ /branches/bleeding_edge/src/ia32/lithium-ia32.h Mon May 26 06:41:21 2014 UTC
@@ -1997,15 +1997,13 @@
 };


-class LUint32ToDouble V8_FINAL : public LTemplateInstruction<1, 1, 1> {
+class LUint32ToDouble V8_FINAL : public LTemplateInstruction<1, 1, 0> {
  public:
-  explicit LUint32ToDouble(LOperand* value, LOperand* temp) {
+  explicit LUint32ToDouble(LOperand* value) {
     inputs_[0] = value;
-    temps_[0] = temp;
   }

   LOperand* value() { return inputs_[0]; }
-  LOperand* temp() { return temps_[0]; }

   DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
 };
@@ -2025,17 +2023,15 @@
 };


-class LNumberTagU V8_FINAL : public LTemplateInstruction<1, 1, 2> {
+class LNumberTagU V8_FINAL : public LTemplateInstruction<1, 1, 1> {
  public:
-  LNumberTagU(LOperand* value, LOperand* temp1, LOperand* temp2) {
+  LNumberTagU(LOperand* value, LOperand* temp) {
     inputs_[0] = value;
-    temps_[0] = temp1;
-    temps_[1] = temp2;
+    temps_[0] = temp;
   }

   LOperand* value() { return inputs_[0]; }
-  LOperand* temp1() { return temps_[0]; }
-  LOperand* temp2() { return temps_[1]; }
+  LOperand* temp() { return temps_[0]; }

   DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u")
 };
=======================================
--- /branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc Fri May 16 15:18:24 2014 UTC +++ /branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc Mon May 26 06:41:21 2014 UTC
@@ -375,16 +375,14 @@


 void MacroAssembler::LoadUint32(XMMRegister dst,
-                                Register src,
-                                XMMRegister scratch) {
+                                Register src) {
   Label done;
   cmp(src, Immediate(0));
   ExternalReference uint32_bias =
         ExternalReference::address_of_uint32_bias();
-  movsd(scratch, Operand::StaticVariable(uint32_bias));
   Cvtsi2sd(dst, src);
   j(not_sign, &done, Label::kNear);
-  addsd(dst, scratch);
+  addsd(dst, Operand::StaticVariable(uint32_bias));
   bind(&done);
 }

=======================================
--- /branches/bleeding_edge/src/ia32/macro-assembler-ia32.h Thu May 15 12:10:00 2014 UTC +++ /branches/bleeding_edge/src/ia32/macro-assembler-ia32.h Mon May 26 06:41:21 2014 UTC
@@ -465,7 +465,7 @@
     j(not_carry, is_smi);
   }

-  void LoadUint32(XMMRegister dst, Register src, XMMRegister scratch);
+  void LoadUint32(XMMRegister dst, Register src);

   // Jump the register contains a smi.
   inline void JumpIfSmi(Register value,
=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Thu May 22 08:37:50 2014 UTC +++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Mon May 26 06:41:21 2014 UTC
@@ -4531,11 +4531,8 @@
 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) {
   LOperand* input = instr->value();
   LOperand* output = instr->result();
-  LOperand* temp = instr->temp();

-  __ LoadUint32(ToDoubleRegister(output),
-                ToRegister(input),
-                ToDoubleRegister(temp));
+  __ LoadUint32(ToDoubleRegister(output), ToRegister(input));
 }


@@ -4582,8 +4579,7 @@
// Load value into temp_xmm which will be preserved across potential call to // runtime (MacroAssembler::EnterExitFrameEpilogue preserves only allocatable
   // XMM registers on x64).
-  XMMRegister xmm_scratch = double_scratch0();
-  __ LoadUint32(temp_xmm, reg, xmm_scratch);
+  __ LoadUint32(temp_xmm, reg);

   if (FLAG_inline_new) {
     __ AllocateHeapNumber(reg, tmp, &slow);
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.cc Fri May 23 14:06:42 2014 UTC +++ /branches/bleeding_edge/src/x64/lithium-x64.cc Mon May 26 06:41:21 2014 UTC
@@ -1904,9 +1904,7 @@
     } else {
       ASSERT(to.IsDouble());
       if (val->CheckFlag(HInstruction::kUint32)) {
-        LOperand* temp = FixedTemp(xmm1);
-        return DefineAsRegister(
-            new(zone()) LUint32ToDouble(UseRegister(val), temp));
+ return DefineAsRegister(new(zone()) LUint32ToDouble(UseRegister(val)));
       } else {
         LOperand* value = Use(val);
         return DefineAsRegister(new(zone()) LInteger32ToDouble(value));
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.h Fri May 23 13:15:07 2014 UTC +++ /branches/bleeding_edge/src/x64/lithium-x64.h Mon May 26 06:41:21 2014 UTC
@@ -1967,15 +1967,13 @@
 };


-class LUint32ToDouble V8_FINAL : public LTemplateInstruction<1, 1, 1> {
+class LUint32ToDouble V8_FINAL : public LTemplateInstruction<1, 1, 0> {
  public:
-  explicit LUint32ToDouble(LOperand* value, LOperand* temp) {
+  explicit LUint32ToDouble(LOperand* value) {
     inputs_[0] = value;
-    temps_[0] = temp;
   }

   LOperand* value() { return inputs_[0]; }
-  LOperand* temp() { return temps_[0]; }

   DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
 };
=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Fri May 16 15:18:24 2014 UTC +++ /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Mon May 26 06:41:21 2014 UTC
@@ -3323,8 +3323,7 @@


 void MacroAssembler::LoadUint32(XMMRegister dst,
-                                Register src,
-                                XMMRegister scratch) {
+                                Register src) {
   if (FLAG_debug_code) {
     cmpq(src, Immediate(0xffffffff));
     Assert(below_equal, kInputGPRIsExpectedToHaveUpper32Cleared);
=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.h Thu May 15 12:10:00 2014 UTC +++ /branches/bleeding_edge/src/x64/macro-assembler-x64.h Mon May 26 06:41:21 2014 UTC
@@ -1004,7 +1004,7 @@
       MinusZeroMode minus_zero_mode, Label* lost_precision,
       Label::Distance dst = Label::kFar);

-  void LoadUint32(XMMRegister dst, Register src, XMMRegister scratch);
+  void LoadUint32(XMMRegister dst, Register src);

   void LoadInstanceDescriptors(Register map, Register descriptors);
   void EnumLength(Register dst, Register map);

--
--
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