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

Side by Side Diff: src/builtins/x64/builtins-x64.cc

Issue 2949813002: [turbofan] Introduce new JSConstructWithArrayLike operator. (Closed)
Patch Set: Address feedback. Created 3 years, 6 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
« no previous file with comments | « src/builtins/mips64/builtins-mips64.cc ('k') | src/code-stub-assembler.h » ('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 // 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/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/counters.h" 9 #include "src/counters.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 1821 matching lines...) Expand 10 before | Expand all | Expand 10 after
1832 } 1832 }
1833 1833
1834 // ----------- S t a t e ------------- 1834 // ----------- S t a t e -------------
1835 // -- rbx : argumentsList 1835 // -- rbx : argumentsList
1836 // -- rdx : new.target 1836 // -- rdx : new.target
1837 // -- rdi : target 1837 // -- rdi : target
1838 // -- rsp[0] : return address 1838 // -- rsp[0] : return address
1839 // -- rsp[8] : receiver (undefined) 1839 // -- rsp[8] : receiver (undefined)
1840 // ----------------------------------- 1840 // -----------------------------------
1841 1841
1842 // 2. Make sure the target is actually a constructor. 1842 // 2. We don't need to check explicitly for constructor target here,
1843 Label target_not_constructor; 1843 // since that's the first thing the Construct/ConstructWithArrayLike
1844 __ JumpIfSmi(rdi, &target_not_constructor, Label::kNear); 1844 // builtins will do.
1845 __ movp(rcx, FieldOperand(rdi, HeapObject::kMapOffset));
1846 __ testb(FieldOperand(rcx, Map::kBitFieldOffset),
1847 Immediate(1 << Map::kIsConstructor));
1848 __ j(zero, &target_not_constructor, Label::kNear);
1849 1845
1850 // 3. Make sure the target is actually a constructor. 1846 // 3. We don't need to check explicitly for constructor new.target here,
1851 Label new_target_not_constructor; 1847 // since that's the second thing the Construct/ConstructWithArrayLike
1852 __ JumpIfSmi(rdx, &new_target_not_constructor, Label::kNear); 1848 // builtins will do.
1853 __ movp(rcx, FieldOperand(rdx, HeapObject::kMapOffset));
1854 __ testb(FieldOperand(rcx, Map::kBitFieldOffset),
1855 Immediate(1 << Map::kIsConstructor));
1856 __ j(zero, &new_target_not_constructor, Label::kNear);
1857 1849
1858 // 4a. Construct the target with the given new.target and argumentsList. 1850 // 4. Construct the target with the given new.target and argumentsList.
1859 __ Jump(masm->isolate()->builtins()->ConstructWithArrayLike(), 1851 __ Jump(masm->isolate()->builtins()->ConstructWithArrayLike(),
1860 RelocInfo::CODE_TARGET); 1852 RelocInfo::CODE_TARGET);
1861
1862 // 4b. The target is not a constructor, throw an appropriate TypeError.
1863 __ bind(&target_not_constructor);
1864 {
1865 StackArgumentsAccessor args(rsp, 0);
1866 __ movp(args.GetReceiverOperand(), rdi);
1867 __ TailCallRuntime(Runtime::kThrowNotConstructor);
1868 }
1869
1870 // 4c. The new.target is not a constructor, throw an appropriate TypeError.
1871 __ bind(&new_target_not_constructor);
1872 {
1873 StackArgumentsAccessor args(rsp, 0);
1874 __ movp(args.GetReceiverOperand(), rdx);
1875 __ TailCallRuntime(Runtime::kThrowNotConstructor);
1876 }
1877 } 1853 }
1878 1854
1879 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { 1855 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) {
1880 // ----------- S t a t e ------------- 1856 // ----------- S t a t e -------------
1881 // -- rax : argc 1857 // -- rax : argc
1882 // -- rsp[0] : return address 1858 // -- rsp[0] : return address
1883 // -- rsp[8] : last argument 1859 // -- rsp[8] : last argument
1884 // ----------------------------------- 1860 // -----------------------------------
1885 Label generic_array_code; 1861 Label generic_array_code;
1886 1862
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
3115 // Now jump to the instructions of the returned code object. 3091 // Now jump to the instructions of the returned code object.
3116 __ jmp(r11); 3092 __ jmp(r11);
3117 } 3093 }
3118 3094
3119 #undef __ 3095 #undef __
3120 3096
3121 } // namespace internal 3097 } // namespace internal
3122 } // namespace v8 3098 } // namespace v8
3123 3099
3124 #endif // V8_TARGET_ARCH_X64 3100 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/builtins/mips64/builtins-mips64.cc ('k') | src/code-stub-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698