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

Side by Side Diff: src/builtins/ia32/builtins-ia32.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/builtins-call-gen.cc ('k') | src/builtins/mips/builtins-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 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_IA32 5 #if V8_TARGET_ARCH_IA32
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/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after
1851 } 1851 }
1852 1852
1853 // ----------- S t a t e ------------- 1853 // ----------- S t a t e -------------
1854 // -- ebx : argumentsList 1854 // -- ebx : argumentsList
1855 // -- edx : new.target 1855 // -- edx : new.target
1856 // -- edi : target 1856 // -- edi : target
1857 // -- esp[0] : return address 1857 // -- esp[0] : return address
1858 // -- esp[4] : receiver (undefined) 1858 // -- esp[4] : receiver (undefined)
1859 // ----------------------------------- 1859 // -----------------------------------
1860 1860
1861 // 2. Make sure the target is actually a constructor. 1861 // 2. We don't need to check explicitly for constructor target here,
1862 Label target_not_constructor; 1862 // since that's the first thing the Construct/ConstructWithArrayLike
1863 __ JumpIfSmi(edi, &target_not_constructor, Label::kNear); 1863 // builtins will do.
1864 __ mov(ecx, FieldOperand(edi, HeapObject::kMapOffset));
1865 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset),
1866 Immediate(1 << Map::kIsConstructor));
1867 __ j(zero, &target_not_constructor, Label::kNear);
1868 1864
1869 // 3. Make sure the target is actually a constructor. 1865 // 3. We don't need to check explicitly for constructor new.target here,
1870 Label new_target_not_constructor; 1866 // since that's the second thing the Construct/ConstructWithArrayLike
1871 __ JumpIfSmi(edx, &new_target_not_constructor, Label::kNear); 1867 // builtins will do.
1872 __ mov(ecx, FieldOperand(edx, HeapObject::kMapOffset));
1873 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset),
1874 Immediate(1 << Map::kIsConstructor));
1875 __ j(zero, &new_target_not_constructor, Label::kNear);
1876 1868
1877 // 4a. Construct the target with the given new.target and argumentsList. 1869 // 4. Construct the target with the given new.target and argumentsList.
1878 __ Jump(masm->isolate()->builtins()->ConstructWithArrayLike(), 1870 __ Jump(masm->isolate()->builtins()->ConstructWithArrayLike(),
1879 RelocInfo::CODE_TARGET); 1871 RelocInfo::CODE_TARGET);
1880
1881 // 4b. The target is not a constructor, throw an appropriate TypeError.
1882 __ bind(&target_not_constructor);
1883 {
1884 __ mov(Operand(esp, kPointerSize), edi);
1885 __ TailCallRuntime(Runtime::kThrowNotConstructor);
1886 }
1887
1888 // 4c. The new.target is not a constructor, throw an appropriate TypeError.
1889 __ bind(&new_target_not_constructor);
1890 {
1891 __ mov(Operand(esp, kPointerSize), edx);
1892 __ TailCallRuntime(Runtime::kThrowNotConstructor);
1893 }
1894 } 1872 }
1895 1873
1896 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { 1874 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) {
1897 // ----------- S t a t e ------------- 1875 // ----------- S t a t e -------------
1898 // -- eax : argc 1876 // -- eax : argc
1899 // -- esp[0] : return address 1877 // -- esp[0] : return address
1900 // -- esp[4] : last argument 1878 // -- esp[4] : last argument
1901 // ----------------------------------- 1879 // -----------------------------------
1902 Label generic_array_code; 1880 Label generic_array_code;
1903 1881
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after
3174 } 3152 }
3175 // Now jump to the instructions of the returned code object. 3153 // Now jump to the instructions of the returned code object.
3176 __ jmp(edi); 3154 __ jmp(edi);
3177 } 3155 }
3178 3156
3179 #undef __ 3157 #undef __
3180 } // namespace internal 3158 } // namespace internal
3181 } // namespace v8 3159 } // namespace v8
3182 3160
3183 #endif // V8_TARGET_ARCH_IA32 3161 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/builtins/builtins-call-gen.cc ('k') | src/builtins/mips/builtins-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698