Refactoring only: Make it clear that MOD is special.
authorsvenpanne@chromium.org <svenpanne@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 17 Sep 2013 07:29:26 +0000 (07:29 +0000)
committersvenpanne@chromium.org <svenpanne@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 17 Sep 2013 07:29:26 +0000 (07:29 +0000)
LArithmeticD should really be 5 different instructions... :-/

R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/23800005

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

src/arm/lithium-arm.cc
src/ia32/lithium-ia32.cc
src/mips/lithium-mips.cc
src/x64/lithium-x64.cc

index ffadada84569f64df18ac5c023018a29627fafc3..8d08df4a33258584ce8b87c92e61be82dd4d247d 100644 (file)
@@ -756,21 +756,20 @@ LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op,
   ASSERT(instr->representation().IsDouble());
   ASSERT(instr->left()->representation().IsDouble());
   ASSERT(instr->right()->representation().IsDouble());
-  LOperand* left = NULL;
-  LOperand* right = NULL;
   if (op == Token::MOD) {
-    left = UseFixedDouble(instr->left(), d1);
-    right = UseFixedDouble(instr->right(), d2);
+    LOperand* left = UseFixedDouble(instr->left(), d1);
+    LOperand* right = UseFixedDouble(instr->right(), d2);
     LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
     // We call a C function for double modulo. It can't trigger a GC. We need
     // to use fixed result register for the call.
     // TODO(fschneider): Allow any register as input registers.
     return MarkAsCall(DefineFixedDouble(result, d1), instr);
+  } else {
+    LOperand* left = UseRegisterAtStart(instr->left());
+    LOperand* right = UseRegisterAtStart(instr->right());
+    LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
+    return DefineAsRegister(result);
   }
-  left = UseRegisterAtStart(instr->left());
-  right = UseRegisterAtStart(instr->right());
-  LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
-  return DefineAsRegister(result);
 }
 
 
index ebcf1b637c222cd654fbe8e4a7ade4aef537132d..77f5706c6f803c07c63d9ccf44794c049375d6bd 100644 (file)
@@ -808,11 +808,17 @@ LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op,
   ASSERT(instr->representation().IsDouble());
   ASSERT(instr->left()->representation().IsDouble());
   ASSERT(instr->right()->representation().IsDouble());
-  LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
-  LOperand* right = UseRegisterAtStart(instr->BetterRightOperand());
-  LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
-  if (op == Token::MOD) return MarkAsCall(DefineSameAsFirst(result), instr);
-  return DefineSameAsFirst(result);
+  if (op == Token::MOD) {
+    LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
+    LOperand* right = UseRegisterAtStart(instr->BetterRightOperand());
+    LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
+    return MarkAsCall(DefineSameAsFirst(result), instr);
+  } else {
+    LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
+    LOperand* right = UseRegisterAtStart(instr->BetterRightOperand());
+    LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
+    return DefineSameAsFirst(result);
+  }
 }
 
 
index f8091206a6051a4961162c74e8638fb3ef0d6ed2..6bb8bbefd98257af39c23d66d3a477da2d83d741 100644 (file)
@@ -761,21 +761,20 @@ LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op,
   ASSERT(instr->representation().IsDouble());
   ASSERT(instr->left()->representation().IsDouble());
   ASSERT(instr->right()->representation().IsDouble());
-  LOperand* left = NULL;
-  LOperand* right = NULL;
   if (op == Token::MOD) {
-    left = UseFixedDouble(instr->left(), f2);
-    right = UseFixedDouble(instr->right(), f4);
+    LOperand* left = UseFixedDouble(instr->left(), f2);
+    LOperand* right = UseFixedDouble(instr->right(), f4);
     LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
     // We call a C function for double modulo. It can't trigger a GC. We need
     // to use fixed result register for the call.
     // TODO(fschneider): Allow any register as input registers.
     return MarkAsCall(DefineFixedDouble(result, f2), instr);
+  } else {
+    LOperand* left = UseRegisterAtStart(instr->left());
+    LOperand* right = UseRegisterAtStart(instr->right());
+    LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
+    return DefineAsRegister(result);
   }
-  left = UseRegisterAtStart(instr->left());
-  right = UseRegisterAtStart(instr->right());
-  LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
-  return DefineAsRegister(result);
 }
 
 
index 662cfce6a037ff77b3b7d58c695ded2b24923524..3a7366e324699dfdfb8ae6b3f42760298b0984e0 100644 (file)
@@ -760,16 +760,17 @@ LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op,
   ASSERT(instr->representation().IsDouble());
   ASSERT(instr->left()->representation().IsDouble());
   ASSERT(instr->right()->representation().IsDouble());
-  LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
-  LOperand* right = NULL;
   if (op == Token::MOD) {
-    right = UseFixedDouble(instr->BetterRightOperand(), xmm1);
+    LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
+    LOperand* right = UseFixedDouble(instr->BetterRightOperand(), xmm1);
     LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
     return MarkAsCall(DefineSameAsFirst(result), instr);
+  } else {
+    LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
+    LOperand* right = UseRegisterAtStart(instr->BetterRightOperand());
+    LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
+    return DefineSameAsFirst(result);
   }
-  right = UseRegisterAtStart(instr->BetterRightOperand());
-  LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
-  return DefineSameAsFirst(result);
 }