| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 6 | 6 |
| 7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 // Due to subnormals, x^-y == (1/x)^y does not hold in all cases. | 480 // Due to subnormals, x^-y == (1/x)^y does not hold in all cases. |
| 481 __ Xorpd(double_scratch2, double_scratch2); | 481 __ Xorpd(double_scratch2, double_scratch2); |
| 482 __ Ucomisd(double_scratch2, double_result); | 482 __ Ucomisd(double_scratch2, double_result); |
| 483 // double_exponent aliased as double_scratch2 has already been overwritten | 483 // double_exponent aliased as double_scratch2 has already been overwritten |
| 484 // and may not have contained the exponent value in the first place when the | 484 // and may not have contained the exponent value in the first place when the |
| 485 // input was a smi. We reset it with exponent value before bailing out. | 485 // input was a smi. We reset it with exponent value before bailing out. |
| 486 __ j(not_equal, &done); | 486 __ j(not_equal, &done); |
| 487 __ Cvtlsi2sd(double_exponent, exponent); | 487 __ Cvtlsi2sd(double_exponent, exponent); |
| 488 | 488 |
| 489 // Returning or bailing out. | 489 // Returning or bailing out. |
| 490 Counters* counters = isolate()->counters(); | |
| 491 if (exponent_type() == ON_STACK) { | 490 if (exponent_type() == ON_STACK) { |
| 492 // The arguments are still on the stack. | 491 // The arguments are still on the stack. |
| 493 __ bind(&call_runtime); | 492 __ bind(&call_runtime); |
| 494 __ TailCallRuntime(Runtime::kMathPowRT); | 493 __ TailCallRuntime(Runtime::kMathPowRT); |
| 495 | 494 |
| 496 // The stub is called from non-optimized code, which expects the result | 495 // The stub is called from non-optimized code, which expects the result |
| 497 // as heap number in rax. | 496 // as heap number in rax. |
| 498 __ bind(&done); | 497 __ bind(&done); |
| 499 __ AllocateHeapNumber(rax, rcx, &call_runtime); | 498 __ AllocateHeapNumber(rax, rcx, &call_runtime); |
| 500 __ Movsd(FieldOperand(rax, HeapNumber::kValueOffset), double_result); | 499 __ Movsd(FieldOperand(rax, HeapNumber::kValueOffset), double_result); |
| 501 __ IncrementCounter(counters->math_pow(), 1); | |
| 502 __ ret(2 * kPointerSize); | 500 __ ret(2 * kPointerSize); |
| 503 } else { | 501 } else { |
| 504 __ bind(&call_runtime); | 502 __ bind(&call_runtime); |
| 505 // Move base to the correct argument register. Exponent is already in xmm1. | 503 // Move base to the correct argument register. Exponent is already in xmm1. |
| 506 __ Movsd(xmm0, double_base); | 504 __ Movsd(xmm0, double_base); |
| 507 DCHECK(double_exponent.is(xmm1)); | 505 DCHECK(double_exponent.is(xmm1)); |
| 508 { | 506 { |
| 509 AllowExternalCallThatCantCauseGC scope(masm); | 507 AllowExternalCallThatCantCauseGC scope(masm); |
| 510 __ PrepareCallCFunction(2); | 508 __ PrepareCallCFunction(2); |
| 511 __ CallCFunction( | 509 __ CallCFunction( |
| 512 ExternalReference::power_double_double_function(isolate()), 2); | 510 ExternalReference::power_double_double_function(isolate()), 2); |
| 513 } | 511 } |
| 514 // Return value is in xmm0. | 512 // Return value is in xmm0. |
| 515 __ Movsd(double_result, xmm0); | 513 __ Movsd(double_result, xmm0); |
| 516 | 514 |
| 517 __ bind(&done); | 515 __ bind(&done); |
| 518 __ IncrementCounter(counters->math_pow(), 1); | |
| 519 __ ret(0); | 516 __ ret(0); |
| 520 } | 517 } |
| 521 } | 518 } |
| 522 | 519 |
| 523 | 520 |
| 524 void FunctionPrototypeStub::Generate(MacroAssembler* masm) { | 521 void FunctionPrototypeStub::Generate(MacroAssembler* masm) { |
| 525 Label miss; | 522 Label miss; |
| 526 Register receiver = LoadDescriptor::ReceiverRegister(); | 523 Register receiver = LoadDescriptor::ReceiverRegister(); |
| 527 // Ensure that the vector and slot registers won't be clobbered before | 524 // Ensure that the vector and slot registers won't be clobbered before |
| 528 // calling the miss handler. | 525 // calling the miss handler. |
| (...skipping 4932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5461 NULL); | 5458 NULL); |
| 5462 } | 5459 } |
| 5463 | 5460 |
| 5464 | 5461 |
| 5465 #undef __ | 5462 #undef __ |
| 5466 | 5463 |
| 5467 } // namespace internal | 5464 } // namespace internal |
| 5468 } // namespace v8 | 5465 } // namespace v8 |
| 5469 | 5466 |
| 5470 #endif // V8_TARGET_ARCH_X64 | 5467 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |