Index: src/ia32/code-stubs-ia32.cc |
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
index 02910ad29743900831e574f7f21b5912eacd6ef7..c939306bb8067e16b3466309fadf485c03f654e0 100644 |
--- a/src/ia32/code-stubs-ia32.cc |
+++ b/src/ia32/code-stubs-ia32.cc |
@@ -2485,6 +2485,8 @@ void TranscendentalCacheStub::Generate(MacroAssembler* masm) { |
__ cmp(edx, Operand(ecx, kIntSize)); |
__ j(not_equal, &cache_miss, Label::kNear); |
// Cache hit! |
+ Counters* counters = masm->isolate()->counters(); |
+ __ IncrementCounter(counters->transcendental_cache_hit(), 1); |
__ mov(eax, Operand(ecx, 2 * kIntSize)); |
if (tagged) { |
__ fstp(0); |
@@ -2495,6 +2497,7 @@ void TranscendentalCacheStub::Generate(MacroAssembler* masm) { |
} |
__ bind(&cache_miss); |
+ __ IncrementCounter(counters->transcendental_cache_miss(), 1); |
// Update cache with new value. |
// We are short on registers, so use no_reg as scratch. |
// This gives slightly larger code. |
@@ -2566,6 +2569,7 @@ Runtime::FunctionId TranscendentalCacheStub::RuntimeFunction() { |
switch (type_) { |
case TranscendentalCache::SIN: return Runtime::kMath_sin; |
case TranscendentalCache::COS: return Runtime::kMath_cos; |
+ case TranscendentalCache::TAN: return Runtime::kMath_tan; |
case TranscendentalCache::LOG: return Runtime::kMath_log; |
default: |
UNIMPLEMENTED(); |
@@ -2579,7 +2583,9 @@ void TranscendentalCacheStub::GenerateOperation(MacroAssembler* masm) { |
// Input value is on FP stack, and also in ebx/edx. |
// Input value is possibly in xmm1. |
// Address of result (a newly allocated HeapNumber) may be in eax. |
- if (type_ == TranscendentalCache::SIN || type_ == TranscendentalCache::COS) { |
+ if (type_ == TranscendentalCache::SIN || |
+ type_ == TranscendentalCache::COS || |
+ type_ == TranscendentalCache::TAN) { |
// Both fsin and fcos require arguments in the range +/-2^63 and |
// return NaN for infinities and NaN. They can share all code except |
// the actual fsin/fcos operation. |
@@ -2650,6 +2656,12 @@ void TranscendentalCacheStub::GenerateOperation(MacroAssembler* masm) { |
case TranscendentalCache::COS: |
__ fcos(); |
break; |
+ case TranscendentalCache::TAN: |
+ // FPTAN computes tangent onto st(0) and pushes 1.0 onto the FP stack. |
+ __ fptan(); |
+ __ ffree(); |
+ __ fincstp(); |
+ break; |
default: |
UNREACHABLE(); |
} |