Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/mips/code-stubs-mips.cc

Issue 8743009: MIPS: Implement Math.tan in generated code. (Closed)
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/mips/full-codegen-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3342 matching lines...) Expand 10 before | Expand all | Expand 10 after
3353 __ sll(t0, a1, 2); 3353 __ sll(t0, a1, 2);
3354 __ Addu(cache_entry, cache_entry, t0); 3354 __ Addu(cache_entry, cache_entry, t0);
3355 3355
3356 // Check if cache matches: Double value is stored in uint32_t[2] array. 3356 // Check if cache matches: Double value is stored in uint32_t[2] array.
3357 __ lw(t0, MemOperand(cache_entry, 0)); 3357 __ lw(t0, MemOperand(cache_entry, 0));
3358 __ lw(t1, MemOperand(cache_entry, 4)); 3358 __ lw(t1, MemOperand(cache_entry, 4));
3359 __ lw(t2, MemOperand(cache_entry, 8)); 3359 __ lw(t2, MemOperand(cache_entry, 8));
3360 __ Branch(&calculate, ne, a2, Operand(t0)); 3360 __ Branch(&calculate, ne, a2, Operand(t0));
3361 __ Branch(&calculate, ne, a3, Operand(t1)); 3361 __ Branch(&calculate, ne, a3, Operand(t1));
3362 // Cache hit. Load result, cleanup and return. 3362 // Cache hit. Load result, cleanup and return.
3363 Counters* counters = masm->isolate()->counters();
3364 __ IncrementCounter(
3365 counters->transcendental_cache_hit(), 1, scratch0, scratch1);
3363 if (tagged) { 3366 if (tagged) {
3364 // Pop input value from stack and load result into v0. 3367 // Pop input value from stack and load result into v0.
3365 __ Drop(1); 3368 __ Drop(1);
3366 __ mov(v0, t2); 3369 __ mov(v0, t2);
3367 } else { 3370 } else {
3368 // Load result into f4. 3371 // Load result into f4.
3369 __ ldc1(f4, FieldMemOperand(t2, HeapNumber::kValueOffset)); 3372 __ ldc1(f4, FieldMemOperand(t2, HeapNumber::kValueOffset));
3370 } 3373 }
3371 __ Ret(); 3374 __ Ret();
3372 } // if (CpuFeatures::IsSupported(FPU)) 3375 } // if (CpuFeatures::IsSupported(FPU))
3373 3376
3374 __ bind(&calculate); 3377 __ bind(&calculate);
3378 Counters* counters = masm->isolate()->counters();
3379 __ IncrementCounter(
3380 counters->transcendental_cache_miss(), 1, scratch0, scratch1);
3375 if (tagged) { 3381 if (tagged) {
3376 __ bind(&invalid_cache); 3382 __ bind(&invalid_cache);
3377 __ TailCallExternalReference(ExternalReference(RuntimeFunction(), 3383 __ TailCallExternalReference(ExternalReference(RuntimeFunction(),
3378 masm->isolate()), 3384 masm->isolate()),
3379 1, 3385 1,
3380 1); 3386 1);
3381 } else { 3387 } else {
3382 if (!CpuFeatures::IsSupported(FPU)) UNREACHABLE(); 3388 if (!CpuFeatures::IsSupported(FPU)) UNREACHABLE();
3383 CpuFeatures::Scope scope(FPU); 3389 CpuFeatures::Scope scope(FPU);
3384 3390
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
3448 void TranscendentalCacheStub::GenerateCallCFunction(MacroAssembler* masm, 3454 void TranscendentalCacheStub::GenerateCallCFunction(MacroAssembler* masm,
3449 Register scratch) { 3455 Register scratch) {
3450 __ push(ra); 3456 __ push(ra);
3451 __ PrepareCallCFunction(2, scratch); 3457 __ PrepareCallCFunction(2, scratch);
3452 if (IsMipsSoftFloatABI) { 3458 if (IsMipsSoftFloatABI) {
3453 __ Move(a0, a1, f4); 3459 __ Move(a0, a1, f4);
3454 } else { 3460 } else {
3455 __ mov_d(f12, f4); 3461 __ mov_d(f12, f4);
3456 } 3462 }
3457 AllowExternalCallThatCantCauseGC scope(masm); 3463 AllowExternalCallThatCantCauseGC scope(masm);
3464 Isolate* isolate = masm->isolate();
3458 switch (type_) { 3465 switch (type_) {
3459 case TranscendentalCache::SIN: 3466 case TranscendentalCache::SIN:
3460 __ CallCFunction( 3467 __ CallCFunction(
3461 ExternalReference::math_sin_double_function(masm->isolate()), 3468 ExternalReference::math_sin_double_function(isolate),
3462 0, 1); 3469 0, 1);
3463 break; 3470 break;
3464 case TranscendentalCache::COS: 3471 case TranscendentalCache::COS:
3465 __ CallCFunction( 3472 __ CallCFunction(
3466 ExternalReference::math_cos_double_function(masm->isolate()), 3473 ExternalReference::math_cos_double_function(isolate),
3474 0, 1);
3475 break;
3476 case TranscendentalCache::TAN:
3477 __ CallCFunction(ExternalReference::math_tan_double_function(isolate),
3467 0, 1); 3478 0, 1);
3468 break; 3479 break;
3469 case TranscendentalCache::LOG: 3480 case TranscendentalCache::LOG:
3470 __ CallCFunction( 3481 __ CallCFunction(
3471 ExternalReference::math_log_double_function(masm->isolate()), 3482 ExternalReference::math_log_double_function(isolate),
3472 0, 1); 3483 0, 1);
3473 break; 3484 break;
3474 default: 3485 default:
3475 UNIMPLEMENTED(); 3486 UNIMPLEMENTED();
3476 break; 3487 break;
3477 } 3488 }
3478 __ pop(ra); 3489 __ pop(ra);
3479 } 3490 }
3480 3491
3481 3492
3482 Runtime::FunctionId TranscendentalCacheStub::RuntimeFunction() { 3493 Runtime::FunctionId TranscendentalCacheStub::RuntimeFunction() {
3483 switch (type_) { 3494 switch (type_) {
3484 // Add more cases when necessary. 3495 // Add more cases when necessary.
3485 case TranscendentalCache::SIN: return Runtime::kMath_sin; 3496 case TranscendentalCache::SIN: return Runtime::kMath_sin;
3486 case TranscendentalCache::COS: return Runtime::kMath_cos; 3497 case TranscendentalCache::COS: return Runtime::kMath_cos;
3498 case TranscendentalCache::TAN: return Runtime::kMath_tan;
3487 case TranscendentalCache::LOG: return Runtime::kMath_log; 3499 case TranscendentalCache::LOG: return Runtime::kMath_log;
3488 default: 3500 default:
3489 UNIMPLEMENTED(); 3501 UNIMPLEMENTED();
3490 return Runtime::kAbort; 3502 return Runtime::kAbort;
3491 } 3503 }
3492 } 3504 }
3493 3505
3494 3506
3495 void StackCheckStub::Generate(MacroAssembler* masm) { 3507 void StackCheckStub::Generate(MacroAssembler* masm) {
3496 __ TailCallRuntime(Runtime::kStackGuard, 0, 1); 3508 __ TailCallRuntime(Runtime::kStackGuard, 0, 1);
(...skipping 3964 matching lines...) Expand 10 before | Expand all | Expand 10 after
7461 &slow_elements); 7473 &slow_elements);
7462 __ Ret(); 7474 __ Ret();
7463 } 7475 }
7464 7476
7465 7477
7466 #undef __ 7478 #undef __
7467 7479
7468 } } // namespace v8::internal 7480 } } // namespace v8::internal
7469 7481
7470 #endif // V8_TARGET_ARCH_MIPS 7482 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698