Landing for Martyn Capewell.
authorager@chromium.org <ager@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 17 Jan 2011 07:26:36 +0000 (07:26 +0000)
committerager@chromium.org <ager@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 17 Jan 2011 07:26:36 +0000 (07:26 +0000)
ARM: Implement DoInteger32ToDouble in lithium codegen. Clean up
temporary register use.

Code review URL: http://codereview.chromium.org/6257003/

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6339 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/arm/assembler-arm.h
src/arm/lithium-codegen-arm.cc
src/arm/lithium-codegen-arm.h

index 86d1082..e0ea819 100644 (file)
@@ -171,7 +171,7 @@ struct DwVfpRegister {
   // d1 has also been excluded from allocation to be used as a scratch
   // register as well.
   static const int kNumRegisters = 16;
-  static const int kNumAllocatableRegisters = 14;
+  static const int kNumAllocatableRegisters = 15;
 
   static int ToAllocationIndex(DwVfpRegister reg) {
     ASSERT(reg.code() != 0);
@@ -180,12 +180,13 @@ struct DwVfpRegister {
 
   static DwVfpRegister FromAllocationIndex(int index) {
     ASSERT(index >= 0 && index < kNumAllocatableRegisters);
-    return from_code(index + 2);
+    return from_code(index + 1);
   }
 
   static const char* AllocationIndexToString(int index) {
     ASSERT(index >= 0 && index < kNumAllocatableRegisters);
     const char* const names[] = {
+      "d1",
       "d2",
       "d3",
       "d4",
index 08ece67..fa96de6 100644 (file)
@@ -2300,7 +2300,7 @@ void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) {
   DoubleRegister input = ToDoubleRegister(instr->input());
   Register result = ToRegister(instr->result());
   Register prev_fpscr = ToRegister(instr->temp());
-  SwVfpRegister single_scratch = single_scratch0();
+  SwVfpRegister single_scratch = double_scratch0().low();
   Register scratch = scratch0();
 
   // Set custom FPCSR:
@@ -2508,7 +2508,19 @@ void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
 
 
 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) {
-  Abort("DoInteger32ToDouble unimplemented.");
+  LOperand* input = instr->input();
+  ASSERT(input->IsRegister() || input->IsStackSlot());
+  LOperand* output = instr->result();
+  ASSERT(output->IsDoubleRegister());
+  SwVfpRegister single_scratch = double_scratch0().low();
+  if (input->IsStackSlot()) {
+    Register scratch = scratch0();
+    __ ldr(scratch, ToMemOperand(input));
+    __ vmov(single_scratch, scratch);
+  } else {
+    __ vmov(single_scratch, ToRegister(input));
+  }
+  __ vcvt_f64_s32(ToDoubleRegister(output), single_scratch);
 }
 
 
index a880d9d..51941d5 100644 (file)
@@ -130,9 +130,7 @@ class LCodeGen BASE_EMBEDDED {
   MacroAssembler* masm() const { return masm_; }
 
   Register scratch0() { return r9; }
-  SwVfpRegister single_scratch0() { return s0; }
-  SwVfpRegister single_scratch1() { return s1; }
-  DwVfpRegister double_scratch0() { return d1; }
+  DwVfpRegister double_scratch0() { return d0; }
 
   int GetNextEmittedBlock(int block);
   LInstruction* GetNextInstruction();