Index: src/x87/code-stubs-x87.cc |
diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc |
index c3903f99ecb04694fabc425f62f3cc0f71275a4b..0fe2cd93c5b47f14d387160f27418fc9232f8a72 100644 |
--- a/src/x87/code-stubs-x87.cc |
+++ b/src/x87/code-stubs-x87.cc |
@@ -325,8 +325,28 @@ void FloatingPointHelper::CheckFloatOperands(MacroAssembler* masm, |
void MathPowStub::Generate(MacroAssembler* masm) { |
- // No SSE2 support |
- UNREACHABLE(); |
+ const Register base = edx; |
+ const Register scratch = ecx; |
+ Counters* counters = isolate()->counters(); |
+ Label call_runtime; |
+ |
+ // We will call runtime helper function directly. |
+ if (exponent_type() == ON_STACK) { |
+ // The arguments are still on the stack. |
+ __ bind(&call_runtime); |
+ __ TailCallRuntime(Runtime::kMathPowRT, 2, 1); |
+ |
+ // The stub is called from non-optimized code, which expects the result |
+ // as heap number in exponent. |
+ __ AllocateHeapNumber(eax, scratch, base, &call_runtime); |
+ __ fstp_d(FieldOperand(eax, HeapNumber::kValueOffset)); |
+ __ IncrementCounter(counters->math_pow(), 1); |
+ __ ret(2 * kPointerSize); |
+ } else { |
+ // Currently it's only called from full-compiler and exponent type is |
+ // ON_STACK. |
+ UNIMPLEMENTED(); |
+ } |
} |