Commit a5ac6662 authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

Small optimization of ARM compare stub. Reverse all references to

left and right sides of the comparison to reflect reality.  Don't
check explicitly for NaNs when using VFP3 since the compare
operation can signal this case with the v flag.  Use cmp instead
of tst in the fast compilers since tst leaves the v flag unchanged
and thus can only work by accident on non-equality comparisons.
Review URL: http://codereview.chromium.org/551048

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3625 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6d7ce681
This diff is collapsed.
......@@ -1592,13 +1592,13 @@ void FastCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
__ pop(r1);
break;
case Token::GT:
// Reverse left and right sizes to obtain ECMA-262 conversion order.
// Reverse left and right sides to obtain ECMA-262 conversion order.
cc = lt;
__ pop(r1);
__ pop(r0);
break;
case Token::LTE:
// Reverse left and right sizes to obtain ECMA-262 conversion order.
// Reverse left and right sides to obtain ECMA-262 conversion order.
cc = ge;
__ pop(r1);
__ pop(r0);
......@@ -1627,7 +1627,7 @@ void FastCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
__ bind(&slow_case);
CompareStub stub(cc, strict);
__ CallStub(&stub);
__ tst(r0, r0);
__ cmp(r0, Operand(0));
__ b(cc, if_true);
__ jmp(if_false);
}
......
......@@ -890,8 +890,13 @@ bool Simulator::OverflowFrom(int32_t alu_out,
// Support for VFP comparisons.
void Simulator::Compute_FPSCR_Flags(double val1, double val2) {
if (isnan(val1) || isnan(val2)) {
n_flag_FPSCR_ = false;
z_flag_FPSCR_ = false;
c_flag_FPSCR_ = true;
v_flag_FPSCR_ = true;
// All non-NaN cases.
if (val1 == val2) {
} else if (val1 == val2) {
n_flag_FPSCR_ = false;
z_flag_FPSCR_ = true;
c_flag_FPSCR_ = true;
......
......@@ -44,6 +44,7 @@
#include "regexp-stack.h"
#include "ast.h"
#include "regexp-macro-assembler.h"
#include "platform.h"
// Include native regexp-macro-assembler.
#ifdef V8_NATIVE_REGEXP
#if V8_TARGET_ARCH_IA32
......@@ -706,13 +707,13 @@ static double div_two_doubles(double x, double y) {
static double mod_two_doubles(double x, double y) {
return fmod(x, y);
return modulo(x, y);
}
static int native_compare_doubles(double x, double y) {
if (x == y) return 0;
return x < y ? 1 : -1;
static int native_compare_doubles(double y, double x) {
if (x == y) return EQUAL;
return x < y ? LESS : GREATER;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment