Reviewers: Lasse Reichstein,

Description:
X64: Fix ToBoolean(floating point).

Please review this at http://codereview.chromium.org/155081

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
   M     src/x64/assembler-x64.cc
   M     src/x64/codegen-x64.cc


Index: src/x64/assembler-x64.cc
===================================================================
--- src/x64/assembler-x64.cc    (revision 2360)
+++ src/x64/assembler-x64.cc    (working copy)
@@ -1449,7 +1449,7 @@
    last_pc_ = pc_;
    if (reg.is(rax)) {
      emit(0xA8);
-    emit(mask);
+    emit(mask.value_);  // Low byte emitted.
    } else {
      if (reg.code() > 3) {
        // Register is not one of al, bl, cl, dl.  Its encoding needs REX.
Index: src/x64/codegen-x64.cc
===================================================================
--- src/x64/codegen-x64.cc      (revision 2360)
+++ src/x64/codegen-x64.cc      (working copy)
@@ -5446,6 +5446,7 @@

    __ bind(&not_string);
    // HeapNumber => false iff +0, -0, or NaN.
+  // These three cases set C3 when compared to zero in the FPU.
    __ Cmp(rdx, Factory::heap_number_map());
    __ j(not_equal, &true_result);
    // TODO(x64): Don't use fp stack, use MMX registers?
@@ -5455,9 +5456,9 @@
    __ fucompp();  // Compare and pop both values.
    __ movq(kScratchRegister, rax);
    __ fnstsw_ax();  // Store fp status word in ax, no checking for  
exceptions.
-  __ testb(rax, Immediate(0x08));  // Test FP condition flag C3.
+  __ testl(rax, Immediate(0x4000));  // Test FP condition flag C3, bit 16.
    __ movq(rax, kScratchRegister);
-  __ j(zero, &false_result);
+  __ j(not_zero, &false_result);
    // Fall through to |true_result|.

    // Return 1/0 for true/false in rax.



--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to