ARM: Implement DoMathRound in the lithium code generator.
Review URL: http://codereview.chromium.org/6519051 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6860 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
1e89c4aa67
commit
24b73a04b0
@ -1204,8 +1204,7 @@ LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
|
||||
case kMathSqrt:
|
||||
return DefineSameAsFirst(result);
|
||||
case kMathRound:
|
||||
Abort("MathRound LUnaryMathOperation not implemented");
|
||||
return NULL;
|
||||
return AssignEnvironment(DefineAsRegister(result));
|
||||
case kMathPowHalf:
|
||||
Abort("MathPowHalf LUnaryMathOperation not implemented");
|
||||
return NULL;
|
||||
|
@ -2609,6 +2609,30 @@ void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) {
|
||||
}
|
||||
|
||||
|
||||
void LCodeGen::DoMathRound(LUnaryMathOperation* instr) {
|
||||
DoubleRegister input = ToDoubleRegister(instr->InputAt(0));
|
||||
Register result = ToRegister(instr->result());
|
||||
Register scratch1 = scratch0();
|
||||
Register scratch2 = result;
|
||||
EmitVFPTruncate(kRoundToNearest,
|
||||
double_scratch0().low(),
|
||||
input,
|
||||
scratch1,
|
||||
scratch2);
|
||||
DeoptimizeIf(ne, instr->environment());
|
||||
__ vmov(result, double_scratch0().low());
|
||||
|
||||
// Test for -0.
|
||||
Label done;
|
||||
__ cmp(result, Operand(0));
|
||||
__ b(ne, &done);
|
||||
__ vmov(scratch1, input.high());
|
||||
__ tst(scratch1, Operand(HeapNumber::kSignMask));
|
||||
DeoptimizeIf(ne, instr->environment());
|
||||
__ bind(&done);
|
||||
}
|
||||
|
||||
|
||||
void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) {
|
||||
DoubleRegister input = ToDoubleRegister(instr->InputAt(0));
|
||||
ASSERT(ToDoubleRegister(instr->result()).is(input));
|
||||
@ -2624,6 +2648,9 @@ void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) {
|
||||
case kMathFloor:
|
||||
DoMathFloor(instr);
|
||||
break;
|
||||
case kMathRound:
|
||||
DoMathRound(instr);
|
||||
break;
|
||||
case kMathSqrt:
|
||||
DoMathSqrt(instr);
|
||||
break;
|
||||
|
@ -212,6 +212,7 @@ class LCodeGen BASE_EMBEDDED {
|
||||
Register scratch1,
|
||||
Register scratch2);
|
||||
void DoMathFloor(LUnaryMathOperation* instr);
|
||||
void DoMathRound(LUnaryMathOperation* instr);
|
||||
void DoMathSqrt(LUnaryMathOperation* instr);
|
||||
|
||||
// Support for recording safepoint and position information.
|
||||
|
Loading…
Reference in New Issue
Block a user