| Index: src/hydrogen.cc
|
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc
|
| index 1e28ceace21330186672a1287689d1ca416caaf2..87b38426dab8b404cb42a4eebf851d312de931e1 100644
|
| --- a/src/hydrogen.cc
|
| +++ b/src/hydrogen.cc
|
| @@ -8217,8 +8217,13 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinFunctionCall(Call* expr) {
|
| if (!FLAG_fast_math) break;
|
| // Fall through if FLAG_fast_math.
|
| case kMathRound:
|
| - case kMathFround:
|
| case kMathFloor:
|
| + // If round has seen minus zero, don't inline, since that assumes
|
| + // returned value is an integer, which -0 definitely is not.
|
| + if (expr->ShouldHandleMinusZeroResult()) {
|
| + break;
|
| + }
|
| + case kMathFround:
|
| case kMathAbs:
|
| case kMathSqrt:
|
| case kMathLog:
|
| @@ -8231,6 +8236,24 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinFunctionCall(Call* expr) {
|
| return true;
|
| }
|
| break;
|
| + case kMathCeil:
|
| + // If round/floor has seen minus zero, don't inline, since that assumes
|
| + // returned value is an integer, which -0 definitely is not.
|
| + if (expr->ShouldHandleMinusZeroResult()) {
|
| + break;
|
| + }
|
| + if (expr->arguments()->length() == 1) {
|
| + HValue* argument = Pop();
|
| + Drop(2); // Receiver and function.
|
| + HValue* neg_arg =
|
| + AddUncasted<HMul>(graph()->GetConstantMinus1(), argument);
|
| + HValue* op = AddUncasted<HUnaryMathOperation>(neg_arg, kMathFloor);
|
| + HInstruction* neg_op =
|
| + NewUncasted<HMul>(graph()->GetConstantMinus1(), op);
|
| + ast_context()->ReturnInstruction(neg_op, expr->id());
|
| + return true;
|
| + }
|
| + break;
|
| case kMathImul:
|
| if (expr->arguments()->length() == 2) {
|
| HValue* right = Pop();
|
| @@ -8324,8 +8347,13 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(
|
| if (!FLAG_fast_math) break;
|
| // Fall through if FLAG_fast_math.
|
| case kMathRound:
|
| - case kMathFround:
|
| case kMathFloor:
|
| + // If round/floor has seen minus zero, don't inline, since that assumes
|
| + // returned value is an integer, which -0 definitely is not.
|
| + if (expr->ShouldHandleMinusZeroResult()) {
|
| + break;
|
| + }
|
| + case kMathFround:
|
| case kMathAbs:
|
| case kMathSqrt:
|
| case kMathLog:
|
| @@ -8338,6 +8366,24 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(
|
| return true;
|
| }
|
| break;
|
| + case kMathCeil:
|
| + // If round/floor has seen minus zero, don't inline, since that assumes
|
| + // returned value is an integer, which -0 definitely is not.
|
| + if (expr->ShouldHandleMinusZeroResult()) {
|
| + break;
|
| + }
|
| + if (argument_count == 2) {
|
| + HValue* argument = Pop();
|
| + Drop(2); // Receiver and function.
|
| + HValue* neg_arg =
|
| + AddUncasted<HMul>(graph()->GetConstantMinus1(), argument);
|
| + HValue* op = AddUncasted<HUnaryMathOperation>(neg_arg, kMathFloor);
|
| + HInstruction* neg_op =
|
| + NewUncasted<HMul>(graph()->GetConstantMinus1(), op);
|
| + ast_context()->ReturnInstruction(neg_op, expr->id());
|
| + return true;
|
| + }
|
| + break;
|
| case kMathPow:
|
| if (argument_count == 3) {
|
| HValue* right = Pop();
|
| @@ -12074,15 +12120,6 @@ void HOptimizedGraphBuilder::GenerateMathClz32(CallRuntime* call) {
|
| }
|
|
|
|
|
| -void HOptimizedGraphBuilder::GenerateMathFloor(CallRuntime* call) {
|
| - DCHECK(call->arguments()->length() == 1);
|
| - CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
|
| - HValue* value = Pop();
|
| - HInstruction* result = NewUncasted<HUnaryMathOperation>(value, kMathFloor);
|
| - return ast_context()->ReturnInstruction(result, call->id());
|
| -}
|
| -
|
| -
|
| void HOptimizedGraphBuilder::GenerateMathLogRT(CallRuntime* call) {
|
| DCHECK(call->arguments()->length() == 1);
|
| CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
|
|
|