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

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

Issue 9580007: Revert r10908 due to flakiness and crashes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 months 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 | Annotate | Revision Log
« no previous file with comments | « src/x64/code-stubs-x64.h ('k') | src/x64/codegen-x64.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after
1621 __ bind(&cache_miss); 1621 __ bind(&cache_miss);
1622 __ IncrementCounter(counters->transcendental_cache_miss(), 1); 1622 __ IncrementCounter(counters->transcendental_cache_miss(), 1);
1623 // Update cache with new value. 1623 // Update cache with new value.
1624 if (tagged) { 1624 if (tagged) {
1625 __ AllocateHeapNumber(rax, rdi, &runtime_call_clear_stack); 1625 __ AllocateHeapNumber(rax, rdi, &runtime_call_clear_stack);
1626 } else { // UNTAGGED. 1626 } else { // UNTAGGED.
1627 __ AllocateHeapNumber(rax, rdi, &skip_cache); 1627 __ AllocateHeapNumber(rax, rdi, &skip_cache);
1628 __ movsd(FieldOperand(rax, HeapNumber::kValueOffset), xmm1); 1628 __ movsd(FieldOperand(rax, HeapNumber::kValueOffset), xmm1);
1629 __ fld_d(FieldOperand(rax, HeapNumber::kValueOffset)); 1629 __ fld_d(FieldOperand(rax, HeapNumber::kValueOffset));
1630 } 1630 }
1631 GenerateOperation(masm, type_); 1631 GenerateOperation(masm);
1632 __ movq(Operand(rcx, 0), rbx); 1632 __ movq(Operand(rcx, 0), rbx);
1633 __ movq(Operand(rcx, 2 * kIntSize), rax); 1633 __ movq(Operand(rcx, 2 * kIntSize), rax);
1634 __ fstp_d(FieldOperand(rax, HeapNumber::kValueOffset)); 1634 __ fstp_d(FieldOperand(rax, HeapNumber::kValueOffset));
1635 if (tagged) { 1635 if (tagged) {
1636 __ ret(kPointerSize); 1636 __ ret(kPointerSize);
1637 } else { // UNTAGGED. 1637 } else { // UNTAGGED.
1638 __ movsd(xmm1, FieldOperand(rax, HeapNumber::kValueOffset)); 1638 __ movsd(xmm1, FieldOperand(rax, HeapNumber::kValueOffset));
1639 __ Ret(); 1639 __ Ret();
1640 1640
1641 // Skip cache and return answer directly, only in untagged case. 1641 // Skip cache and return answer directly, only in untagged case.
1642 __ bind(&skip_cache); 1642 __ bind(&skip_cache);
1643 __ subq(rsp, Immediate(kDoubleSize)); 1643 __ subq(rsp, Immediate(kDoubleSize));
1644 __ movsd(Operand(rsp, 0), xmm1); 1644 __ movsd(Operand(rsp, 0), xmm1);
1645 __ fld_d(Operand(rsp, 0)); 1645 __ fld_d(Operand(rsp, 0));
1646 GenerateOperation(masm, type_); 1646 GenerateOperation(masm);
1647 __ fstp_d(Operand(rsp, 0)); 1647 __ fstp_d(Operand(rsp, 0));
1648 __ movsd(xmm1, Operand(rsp, 0)); 1648 __ movsd(xmm1, Operand(rsp, 0));
1649 __ addq(rsp, Immediate(kDoubleSize)); 1649 __ addq(rsp, Immediate(kDoubleSize));
1650 // We return the value in xmm1 without adding it to the cache, but 1650 // We return the value in xmm1 without adding it to the cache, but
1651 // we cause a scavenging GC so that future allocations will succeed. 1651 // we cause a scavenging GC so that future allocations will succeed.
1652 { 1652 {
1653 FrameScope scope(masm, StackFrame::INTERNAL); 1653 FrameScope scope(masm, StackFrame::INTERNAL);
1654 // Allocate an unused object bigger than a HeapNumber. 1654 // Allocate an unused object bigger than a HeapNumber.
1655 __ Push(Smi::FromInt(2 * kDoubleSize)); 1655 __ Push(Smi::FromInt(2 * kDoubleSize));
1656 __ CallRuntimeSaveDoubles(Runtime::kAllocateInNewSpace); 1656 __ CallRuntimeSaveDoubles(Runtime::kAllocateInNewSpace);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1688 case TranscendentalCache::COS: return Runtime::kMath_cos; 1688 case TranscendentalCache::COS: return Runtime::kMath_cos;
1689 case TranscendentalCache::TAN: return Runtime::kMath_tan; 1689 case TranscendentalCache::TAN: return Runtime::kMath_tan;
1690 case TranscendentalCache::LOG: return Runtime::kMath_log; 1690 case TranscendentalCache::LOG: return Runtime::kMath_log;
1691 default: 1691 default:
1692 UNIMPLEMENTED(); 1692 UNIMPLEMENTED();
1693 return Runtime::kAbort; 1693 return Runtime::kAbort;
1694 } 1694 }
1695 } 1695 }
1696 1696
1697 1697
1698 void TranscendentalCacheStub::GenerateOperation( 1698 void TranscendentalCacheStub::GenerateOperation(MacroAssembler* masm) {
1699 MacroAssembler* masm, TranscendentalCache::Type type) {
1700 // Registers: 1699 // Registers:
1701 // rax: Newly allocated HeapNumber, which must be preserved. 1700 // rax: Newly allocated HeapNumber, which must be preserved.
1702 // rbx: Bits of input double. Must be preserved. 1701 // rbx: Bits of input double. Must be preserved.
1703 // rcx: Pointer to cache entry. Must be preserved. 1702 // rcx: Pointer to cache entry. Must be preserved.
1704 // st(0): Input double 1703 // st(0): Input double
1705 Label done; 1704 Label done;
1706 if (type == TranscendentalCache::SIN || 1705 if (type_ == TranscendentalCache::SIN ||
1707 type == TranscendentalCache::COS || 1706 type_ == TranscendentalCache::COS ||
1708 type == TranscendentalCache::TAN) { 1707 type_ == TranscendentalCache::TAN) {
1709 // Both fsin and fcos require arguments in the range +/-2^63 and 1708 // Both fsin and fcos require arguments in the range +/-2^63 and
1710 // return NaN for infinities and NaN. They can share all code except 1709 // return NaN for infinities and NaN. They can share all code except
1711 // the actual fsin/fcos operation. 1710 // the actual fsin/fcos operation.
1712 Label in_range; 1711 Label in_range;
1713 // If argument is outside the range -2^63..2^63, fsin/cos doesn't 1712 // If argument is outside the range -2^63..2^63, fsin/cos doesn't
1714 // work. We must reduce it to the appropriate range. 1713 // work. We must reduce it to the appropriate range.
1715 __ movq(rdi, rbx); 1714 __ movq(rdi, rbx);
1716 // Move exponent and sign bits to low bits. 1715 // Move exponent and sign bits to low bits.
1717 __ shr(rdi, Immediate(HeapNumber::kMantissaBits)); 1716 __ shr(rdi, Immediate(HeapNumber::kMantissaBits));
1718 // Remove sign bit. 1717 // Remove sign bit.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1761 // continue computation. 1760 // continue computation.
1762 __ j(not_zero, &partial_remainder_loop); 1761 __ j(not_zero, &partial_remainder_loop);
1763 } 1762 }
1764 // FPU Stack: input, 2*pi, input % 2*pi 1763 // FPU Stack: input, 2*pi, input % 2*pi
1765 __ fstp(2); 1764 __ fstp(2);
1766 // FPU Stack: input % 2*pi, 2*pi, 1765 // FPU Stack: input % 2*pi, 2*pi,
1767 __ fstp(0); 1766 __ fstp(0);
1768 // FPU Stack: input % 2*pi 1767 // FPU Stack: input % 2*pi
1769 __ movq(rax, rdi); // Restore rax, pointer to the new HeapNumber. 1768 __ movq(rax, rdi); // Restore rax, pointer to the new HeapNumber.
1770 __ bind(&in_range); 1769 __ bind(&in_range);
1771 switch (type) { 1770 switch (type_) {
1772 case TranscendentalCache::SIN: 1771 case TranscendentalCache::SIN:
1773 __ fsin(); 1772 __ fsin();
1774 break; 1773 break;
1775 case TranscendentalCache::COS: 1774 case TranscendentalCache::COS:
1776 __ fcos(); 1775 __ fcos();
1777 break; 1776 break;
1778 case TranscendentalCache::TAN: 1777 case TranscendentalCache::TAN:
1779 // FPTAN calculates tangent onto st(0) and pushes 1.0 onto the 1778 // FPTAN calculates tangent onto st(0) and pushes 1.0 onto the
1780 // FP register stack. 1779 // FP register stack.
1781 __ fptan(); 1780 __ fptan();
1782 __ fstp(0); // Pop FP register stack. 1781 __ fstp(0); // Pop FP register stack.
1783 break; 1782 break;
1784 default: 1783 default:
1785 UNREACHABLE(); 1784 UNREACHABLE();
1786 } 1785 }
1787 __ bind(&done); 1786 __ bind(&done);
1788 } else { 1787 } else {
1789 ASSERT(type == TranscendentalCache::LOG); 1788 ASSERT(type_ == TranscendentalCache::LOG);
1790 __ fldln2(); 1789 __ fldln2();
1791 __ fxch(); 1790 __ fxch();
1792 __ fyl2x(); 1791 __ fyl2x();
1793 } 1792 }
1794 } 1793 }
1795 1794
1796 1795
1797 // Input: rdx, rax are the left and right objects of a bit op. 1796 // Input: rdx, rax are the left and right objects of a bit op.
1798 // Output: rax, rcx are left and right integers for a bit op. 1797 // Output: rax, rcx are left and right integers for a bit op.
1799 void FloatingPointHelper::LoadNumbersAsIntegers(MacroAssembler* masm) { 1798 void FloatingPointHelper::LoadNumbersAsIntegers(MacroAssembler* masm) {
(...skipping 4527 matching lines...) Expand 10 before | Expand all | Expand 10 after
6327 xmm0, 6326 xmm0,
6328 &slow_elements); 6327 &slow_elements);
6329 __ ret(0); 6328 __ ret(0);
6330 } 6329 }
6331 6330
6332 #undef __ 6331 #undef __
6333 6332
6334 } } // namespace v8::internal 6333 } } // namespace v8::internal
6335 6334
6336 #endif // V8_TARGET_ARCH_X64 6335 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.h ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698