OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 3254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3265 // Find the address of the r1'st entry in the cache, i.e., &r0[r1*12]. | 3265 // Find the address of the r1'st entry in the cache, i.e., &r0[r1*12]. |
3266 __ add(r1, r1, Operand(r1, LSL, 1)); | 3266 __ add(r1, r1, Operand(r1, LSL, 1)); |
3267 __ add(cache_entry, cache_entry, Operand(r1, LSL, 2)); | 3267 __ add(cache_entry, cache_entry, Operand(r1, LSL, 2)); |
3268 // Check if cache matches: Double value is stored in uint32_t[2] array. | 3268 // Check if cache matches: Double value is stored in uint32_t[2] array. |
3269 __ ldm(ia, cache_entry, r4.bit() | r5.bit() | r6.bit()); | 3269 __ ldm(ia, cache_entry, r4.bit() | r5.bit() | r6.bit()); |
3270 __ cmp(r2, r4); | 3270 __ cmp(r2, r4); |
3271 __ b(ne, &calculate); | 3271 __ b(ne, &calculate); |
3272 __ cmp(r3, r5); | 3272 __ cmp(r3, r5); |
3273 __ b(ne, &calculate); | 3273 __ b(ne, &calculate); |
3274 // Cache hit. Load result, cleanup and return. | 3274 // Cache hit. Load result, cleanup and return. |
| 3275 Counters* counters = masm->isolate()->counters(); |
| 3276 __ IncrementCounter(counters->transcendental_cache_hit(), 1); |
3275 if (tagged) { | 3277 if (tagged) { |
3276 // Pop input value from stack and load result into r0. | 3278 // Pop input value from stack and load result into r0. |
3277 __ pop(); | 3279 __ pop(); |
3278 __ mov(r0, Operand(r6)); | 3280 __ mov(r0, Operand(r6)); |
3279 } else { | 3281 } else { |
3280 // Load result into d2. | 3282 // Load result into d2. |
3281 __ vldr(d2, FieldMemOperand(r6, HeapNumber::kValueOffset)); | 3283 __ vldr(d2, FieldMemOperand(r6, HeapNumber::kValueOffset)); |
3282 } | 3284 } |
3283 __ Ret(); | 3285 __ Ret(); |
3284 } // if (CpuFeatures::IsSupported(VFP3)) | 3286 } // if (CpuFeatures::IsSupported(VFP3)) |
3285 | 3287 |
3286 __ bind(&calculate); | 3288 __ bind(&calculate); |
| 3289 __ IncrementCounter(counters->transcendental_cache_miss(), 1); |
3287 if (tagged) { | 3290 if (tagged) { |
3288 __ bind(&invalid_cache); | 3291 __ bind(&invalid_cache); |
3289 ExternalReference runtime_function = | 3292 ExternalReference runtime_function = |
3290 ExternalReference(RuntimeFunction(), masm->isolate()); | 3293 ExternalReference(RuntimeFunction(), masm->isolate()); |
3291 __ TailCallExternalReference(runtime_function, 1, 1); | 3294 __ TailCallExternalReference(runtime_function, 1, 1); |
3292 } else { | 3295 } else { |
3293 if (!CpuFeatures::IsSupported(VFP3)) UNREACHABLE(); | 3296 if (!CpuFeatures::IsSupported(VFP3)) UNREACHABLE(); |
3294 CpuFeatures::Scope scope(VFP3); | 3297 CpuFeatures::Scope scope(VFP3); |
3295 | 3298 |
3296 Label no_update; | 3299 Label no_update; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3364 AllowExternalCallThatCantCauseGC scope(masm); | 3367 AllowExternalCallThatCantCauseGC scope(masm); |
3365 switch (type_) { | 3368 switch (type_) { |
3366 case TranscendentalCache::SIN: | 3369 case TranscendentalCache::SIN: |
3367 __ CallCFunction(ExternalReference::math_sin_double_function(isolate), | 3370 __ CallCFunction(ExternalReference::math_sin_double_function(isolate), |
3368 0, 1); | 3371 0, 1); |
3369 break; | 3372 break; |
3370 case TranscendentalCache::COS: | 3373 case TranscendentalCache::COS: |
3371 __ CallCFunction(ExternalReference::math_cos_double_function(isolate), | 3374 __ CallCFunction(ExternalReference::math_cos_double_function(isolate), |
3372 0, 1); | 3375 0, 1); |
3373 break; | 3376 break; |
| 3377 case TranscendentalCache::TAN: |
| 3378 __ CallCFunction(ExternalReference::math_tan_double_function(isolate), |
| 3379 0, 1); |
| 3380 break; |
3374 case TranscendentalCache::LOG: | 3381 case TranscendentalCache::LOG: |
3375 __ CallCFunction(ExternalReference::math_log_double_function(isolate), | 3382 __ CallCFunction(ExternalReference::math_log_double_function(isolate), |
3376 0, 1); | 3383 0, 1); |
3377 break; | 3384 break; |
3378 default: | 3385 default: |
3379 UNIMPLEMENTED(); | 3386 UNIMPLEMENTED(); |
3380 break; | 3387 break; |
3381 } | 3388 } |
3382 __ pop(lr); | 3389 __ pop(lr); |
3383 } | 3390 } |
3384 | 3391 |
3385 | 3392 |
3386 Runtime::FunctionId TranscendentalCacheStub::RuntimeFunction() { | 3393 Runtime::FunctionId TranscendentalCacheStub::RuntimeFunction() { |
3387 switch (type_) { | 3394 switch (type_) { |
3388 // Add more cases when necessary. | 3395 // Add more cases when necessary. |
3389 case TranscendentalCache::SIN: return Runtime::kMath_sin; | 3396 case TranscendentalCache::SIN: return Runtime::kMath_sin; |
3390 case TranscendentalCache::COS: return Runtime::kMath_cos; | 3397 case TranscendentalCache::COS: return Runtime::kMath_cos; |
| 3398 case TranscendentalCache::TAN: return Runtime::kMath_tan; |
3391 case TranscendentalCache::LOG: return Runtime::kMath_log; | 3399 case TranscendentalCache::LOG: return Runtime::kMath_log; |
3392 default: | 3400 default: |
3393 UNIMPLEMENTED(); | 3401 UNIMPLEMENTED(); |
3394 return Runtime::kAbort; | 3402 return Runtime::kAbort; |
3395 } | 3403 } |
3396 } | 3404 } |
3397 | 3405 |
3398 | 3406 |
3399 void StackCheckStub::Generate(MacroAssembler* masm) { | 3407 void StackCheckStub::Generate(MacroAssembler* masm) { |
3400 __ TailCallRuntime(Runtime::kStackGuard, 0, 1); | 3408 __ TailCallRuntime(Runtime::kStackGuard, 0, 1); |
(...skipping 3768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7169 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r10, | 7177 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r10, |
7170 &slow_elements); | 7178 &slow_elements); |
7171 __ Ret(); | 7179 __ Ret(); |
7172 } | 7180 } |
7173 | 7181 |
7174 #undef __ | 7182 #undef __ |
7175 | 7183 |
7176 } } // namespace v8::internal | 7184 } } // namespace v8::internal |
7177 | 7185 |
7178 #endif // V8_TARGET_ARCH_ARM | 7186 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |