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

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 148503002: A64: Synchronize with r15545. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 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/ic-x64.cc ('k') | src/x64/lithium-gap-resolver-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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #if defined(V8_TARGET_ARCH_X64) 30 #if V8_TARGET_ARCH_X64
31 31
32 #include "x64/lithium-codegen-x64.h" 32 #include "x64/lithium-codegen-x64.h"
33 #include "code-stubs.h" 33 #include "code-stubs.h"
34 #include "stub-cache.h" 34 #include "stub-cache.h"
35 35
36 namespace v8 { 36 namespace v8 {
37 namespace internal { 37 namespace internal {
38 38
39 39
40 // When invoking builtins, we need to record the safepoint in the middle of 40 // When invoking builtins, we need to record the safepoint in the middle of
(...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after
1546 AllowDeferredHandleDereference smi_check; 1546 AllowDeferredHandleDereference smi_check;
1547 if (value->IsSmi()) { 1547 if (value->IsSmi()) {
1548 __ Move(ToRegister(instr->result()), value); 1548 __ Move(ToRegister(instr->result()), value);
1549 } else { 1549 } else {
1550 __ LoadHeapObject(ToRegister(instr->result()), 1550 __ LoadHeapObject(ToRegister(instr->result()),
1551 Handle<HeapObject>::cast(value)); 1551 Handle<HeapObject>::cast(value));
1552 } 1552 }
1553 } 1553 }
1554 1554
1555 1555
1556 void LCodeGen::DoFixedArrayBaseLength(LFixedArrayBaseLength* instr) {
1557 Register result = ToRegister(instr->result());
1558 Register array = ToRegister(instr->value());
1559 __ movq(result, FieldOperand(array, FixedArrayBase::kLengthOffset));
1560 }
1561
1562
1563 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { 1556 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) {
1564 Register result = ToRegister(instr->result()); 1557 Register result = ToRegister(instr->result());
1565 Register map = ToRegister(instr->value()); 1558 Register map = ToRegister(instr->value());
1566 __ EnumLength(result, map); 1559 __ EnumLength(result, map);
1567 } 1560 }
1568 1561
1569 1562
1570 void LCodeGen::DoElementsKind(LElementsKind* instr) { 1563 void LCodeGen::DoElementsKind(LElementsKind* instr) {
1571 Register result = ToRegister(instr->result()); 1564 Register result = ToRegister(instr->result());
1572 Register input = ToRegister(instr->value()); 1565 Register input = ToRegister(instr->value());
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
1834 int LCodeGen::GetNextEmittedBlock() const { 1827 int LCodeGen::GetNextEmittedBlock() const {
1835 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { 1828 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) {
1836 if (!chunk_->GetLabel(i)->HasReplacement()) return i; 1829 if (!chunk_->GetLabel(i)->HasReplacement()) return i;
1837 } 1830 }
1838 return -1; 1831 return -1;
1839 } 1832 }
1840 1833
1841 1834
1842 template<class InstrType> 1835 template<class InstrType>
1843 void LCodeGen::EmitBranch(InstrType instr, Condition cc) { 1836 void LCodeGen::EmitBranch(InstrType instr, Condition cc) {
1837 int left_block = instr->TrueDestination(chunk_);
1844 int right_block = instr->FalseDestination(chunk_); 1838 int right_block = instr->FalseDestination(chunk_);
1845 int left_block = instr->TrueDestination(chunk_);
1846 1839
1847 int next_block = GetNextEmittedBlock(); 1840 int next_block = GetNextEmittedBlock();
1848 1841
1849 if (right_block == left_block) { 1842 if (right_block == left_block || cc == no_condition) {
1850 EmitGoto(left_block); 1843 EmitGoto(left_block);
1851 } else if (left_block == next_block) { 1844 } else if (left_block == next_block) {
1852 __ j(NegateCondition(cc), chunk_->GetAssemblyLabel(right_block)); 1845 __ j(NegateCondition(cc), chunk_->GetAssemblyLabel(right_block));
1853 } else if (right_block == next_block) { 1846 } else if (right_block == next_block) {
1854 __ j(cc, chunk_->GetAssemblyLabel(left_block)); 1847 __ j(cc, chunk_->GetAssemblyLabel(left_block));
1855 } else { 1848 } else {
1856 __ j(cc, chunk_->GetAssemblyLabel(left_block)); 1849 __ j(cc, chunk_->GetAssemblyLabel(left_block));
1857 if (cc != always) { 1850 if (cc != always) {
1858 __ jmp(chunk_->GetAssemblyLabel(right_block)); 1851 __ jmp(chunk_->GetAssemblyLabel(right_block));
1859 } 1852 }
1860 } 1853 }
1861 } 1854 }
1862 1855
1863 1856
1864 void LCodeGen::DoDebugBreak(LDebugBreak* instr) { 1857 void LCodeGen::DoDebugBreak(LDebugBreak* instr) {
1865 __ int3(); 1858 __ int3();
1866 } 1859 }
1867 1860
1868 1861
1862 void LCodeGen::DoIsNumberAndBranch(LIsNumberAndBranch* instr) {
1863 Representation r = instr->hydrogen()->value()->representation();
1864 if (r.IsSmiOrInteger32() || r.IsDouble()) {
1865 EmitBranch(instr, no_condition);
1866 } else {
1867 ASSERT(r.IsTagged());
1868 Register reg = ToRegister(instr->value());
1869 HType type = instr->hydrogen()->value()->type();
1870 if (type.IsTaggedNumber()) {
1871 EmitBranch(instr, no_condition);
1872 }
1873 __ JumpIfSmi(reg, instr->TrueLabel(chunk_));
1874 __ CompareRoot(FieldOperand(reg, HeapObject::kMapOffset),
1875 Heap::kHeapNumberMapRootIndex);
1876 EmitBranch(instr, equal);
1877 }
1878 }
1879
1880
1869 void LCodeGen::DoBranch(LBranch* instr) { 1881 void LCodeGen::DoBranch(LBranch* instr) {
1870 Representation r = instr->hydrogen()->value()->representation(); 1882 Representation r = instr->hydrogen()->value()->representation();
1871 if (r.IsInteger32()) { 1883 if (r.IsInteger32()) {
1872 ASSERT(!info()->IsStub()); 1884 ASSERT(!info()->IsStub());
1873 Register reg = ToRegister(instr->value()); 1885 Register reg = ToRegister(instr->value());
1874 __ testl(reg, reg); 1886 __ testl(reg, reg);
1875 EmitBranch(instr, not_zero); 1887 EmitBranch(instr, not_zero);
1876 } else if (r.IsSmi()) { 1888 } else if (r.IsSmi()) {
1877 ASSERT(!info()->IsStub()); 1889 ASSERT(!info()->IsStub());
1878 Register reg = ToRegister(instr->value()); 1890 Register reg = ToRegister(instr->value());
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2027 break; 2039 break;
2028 case Token::IN: 2040 case Token::IN:
2029 case Token::INSTANCEOF: 2041 case Token::INSTANCEOF:
2030 default: 2042 default:
2031 UNREACHABLE(); 2043 UNREACHABLE();
2032 } 2044 }
2033 return cond; 2045 return cond;
2034 } 2046 }
2035 2047
2036 2048
2037 void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) { 2049 void LCodeGen::DoCompareNumericAndBranch(LCompareNumericAndBranch* instr) {
2038 LOperand* left = instr->left(); 2050 LOperand* left = instr->left();
2039 LOperand* right = instr->right(); 2051 LOperand* right = instr->right();
2040 Condition cc = TokenToCondition(instr->op(), instr->is_double()); 2052 Condition cc = TokenToCondition(instr->op(), instr->is_double());
2041 2053
2042 if (left->IsConstantOperand() && right->IsConstantOperand()) { 2054 if (left->IsConstantOperand() && right->IsConstantOperand()) {
2043 // We can statically evaluate the comparison. 2055 // We can statically evaluate the comparison.
2044 double left_val = ToDouble(LConstantOperand::cast(left)); 2056 double left_val = ToDouble(LConstantOperand::cast(left));
2045 double right_val = ToDouble(LConstantOperand::cast(right)); 2057 double right_val = ToDouble(LConstantOperand::cast(right));
2046 int next_block = EvalComparison(instr->op(), left_val, right_val) ? 2058 int next_block = EvalComparison(instr->op(), left_val, right_val) ?
2047 instr->TrueDestination(chunk_) : instr->FalseDestination(chunk_); 2059 instr->TrueDestination(chunk_) : instr->FalseDestination(chunk_);
(...skipping 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after
3870 } 3882 }
3871 3883
3872 3884
3873 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { 3885 void LCodeGen::DoCallNewArray(LCallNewArray* instr) {
3874 ASSERT(ToRegister(instr->constructor()).is(rdi)); 3886 ASSERT(ToRegister(instr->constructor()).is(rdi));
3875 ASSERT(ToRegister(instr->result()).is(rax)); 3887 ASSERT(ToRegister(instr->result()).is(rax));
3876 3888
3877 __ Set(rax, instr->arity()); 3889 __ Set(rax, instr->arity());
3878 __ Move(rbx, instr->hydrogen()->property_cell()); 3890 __ Move(rbx, instr->hydrogen()->property_cell());
3879 ElementsKind kind = instr->hydrogen()->elements_kind(); 3891 ElementsKind kind = instr->hydrogen()->elements_kind();
3880 bool disable_allocation_sites = 3892 AllocationSiteOverrideMode override_mode =
3881 (AllocationSiteInfo::GetMode(kind) == TRACK_ALLOCATION_SITE); 3893 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE)
3894 ? DISABLE_ALLOCATION_SITES
3895 : DONT_OVERRIDE;
3896 ContextCheckMode context_mode = CONTEXT_CHECK_NOT_REQUIRED;
3882 3897
3883 if (instr->arity() == 0) { 3898 if (instr->arity() == 0) {
3884 ArrayNoArgumentConstructorStub stub(kind, disable_allocation_sites); 3899 ArrayNoArgumentConstructorStub stub(kind, context_mode, override_mode);
3885 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); 3900 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
3886 } else if (instr->arity() == 1) { 3901 } else if (instr->arity() == 1) {
3887 Label done; 3902 Label done;
3888 if (IsFastPackedElementsKind(kind)) { 3903 if (IsFastPackedElementsKind(kind)) {
3889 Label packed_case; 3904 Label packed_case;
3890 // We might need a change here 3905 // We might need a change here
3891 // look at the first argument 3906 // look at the first argument
3892 __ movq(rcx, Operand(rsp, 0)); 3907 __ movq(rcx, Operand(rsp, 0));
3893 __ testq(rcx, rcx); 3908 __ testq(rcx, rcx);
3894 __ j(zero, &packed_case); 3909 __ j(zero, &packed_case);
3895 3910
3896 ElementsKind holey_kind = GetHoleyElementsKind(kind); 3911 ElementsKind holey_kind = GetHoleyElementsKind(kind);
3897 ArraySingleArgumentConstructorStub stub(holey_kind, 3912 ArraySingleArgumentConstructorStub stub(holey_kind, context_mode,
3898 disable_allocation_sites); 3913 override_mode);
3899 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); 3914 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
3900 __ jmp(&done); 3915 __ jmp(&done);
3901 __ bind(&packed_case); 3916 __ bind(&packed_case);
3902 } 3917 }
3903 3918
3904 ArraySingleArgumentConstructorStub stub(kind, disable_allocation_sites); 3919 ArraySingleArgumentConstructorStub stub(kind, context_mode, override_mode);
3905 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); 3920 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
3906 __ bind(&done); 3921 __ bind(&done);
3907 } else { 3922 } else {
3908 ArrayNArgumentsConstructorStub stub(kind, disable_allocation_sites); 3923 ArrayNArgumentsConstructorStub stub(kind, context_mode, override_mode);
3909 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); 3924 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
3910 } 3925 }
3911 } 3926 }
3912 3927
3913 3928
3914 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { 3929 void LCodeGen::DoCallRuntime(LCallRuntime* instr) {
3915 CallRuntime(instr->function(), instr->arity(), instr); 3930 CallRuntime(instr->function(), instr->arity(), instr);
3916 } 3931 }
3917 3932
3918 3933
(...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after
5650 FixedArray::kHeaderSize - kPointerSize)); 5665 FixedArray::kHeaderSize - kPointerSize));
5651 __ bind(&done); 5666 __ bind(&done);
5652 } 5667 }
5653 5668
5654 5669
5655 #undef __ 5670 #undef __
5656 5671
5657 } } // namespace v8::internal 5672 } } // namespace v8::internal
5658 5673
5659 #endif // V8_TARGET_ARCH_X64 5674 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/ic-x64.cc ('k') | src/x64/lithium-gap-resolver-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698