Reviewers: baptiste.afsa1, ulan,

Description:
Implement a code stub for floating point modulo operation

BUG=none
[email protected],[email protected]
LOG=y

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

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

Affected files (+16, -9 lines):
  M src/a64/code-stubs-a64.cc


Index: src/a64/code-stubs-a64.cc
diff --git a/src/a64/code-stubs-a64.cc b/src/a64/code-stubs-a64.cc
index 959958e4c520344acd4ed7ed081be12e2bb3078f..6e7593aad3fb4c041303cc60717167ba471a8e5d 100644
--- a/src/a64/code-stubs-a64.cc
+++ b/src/a64/code-stubs-a64.cc
@@ -1327,7 +1327,7 @@ void BinaryOpStub_GenerateFPOperation(MacroAssembler* masm,
   FPRegister result_d = d0;
   Register right = x0;
   Register left = x1;
-  Register heap_result = x3;
+  Register heap_result = x19;

   ASSERT(smi_operands || (not_numbers != NULL));
   if (smi_operands) {
@@ -1350,8 +1350,8 @@ void BinaryOpStub_GenerateFPOperation(MacroAssembler* masm,
     case Token::MUL:
     case Token::DIV:
     case Token::MOD: {
-      FPRegister right_d = d0;
-      FPRegister left_d = d1;
+      FPRegister left_d = d0;
+      FPRegister right_d = d1;
       Label do_operation;

       __ SmiUntagToDouble(left_d, left, kSpeculativeUntag);
@@ -1383,21 +1383,28 @@ void BinaryOpStub_GenerateFPOperation(MacroAssembler* masm,

// Left and right are doubles in left_d and right_d. Calculate the result.
       __ Bind(&do_operation);
+
+      BinaryOpStub_GenerateHeapResultAllocation(
+          masm, heap_result, heap_number_map, x10, x11, gc_required, mode);
+
       switch (op) {
         case Token::ADD: __ Fadd(result_d, left_d, right_d); break;
         case Token::SUB: __ Fsub(result_d, left_d, right_d); break;
         case Token::MUL: __ Fmul(result_d, left_d, right_d); break;
         case Token::DIV: __ Fdiv(result_d, left_d, right_d); break;
-        case Token::MOD:
-          ASM_UNIMPLEMENTED("Implement HeapNumber modulo");
-          __ B(miss);
+        case Token::MOD: {
+          Register saved_lr = x20;
+          __ Mov(saved_lr, lr);
+          AllowExternalCallThatCantCauseGC scope(masm);
+          __ CallCFunction(
+              ExternalReference::double_fp_operation(op, masm->isolate()),
+              0, 2);
+          __ Mov(lr, saved_lr);
           break;
+        }
         default: UNREACHABLE();
       }

-      BinaryOpStub_GenerateHeapResultAllocation(
-          masm, heap_result, heap_number_map, x10, x11, gc_required, mode);
-
__ Str(result_d, FieldMemOperand(heap_result, HeapNumber::kValueOffset));
       __ Mov(result, heap_result);
       __ Ret();


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