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

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

Issue 1235273003: X87: Switch CallConstructStub to take new.target in register. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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/x87/builtins-x87.cc ('k') | src/x87/full-codegen-x87.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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X87 7 #if V8_TARGET_ARCH_X87
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after
1827 1827
1828 1828
1829 void CallFunctionStub::Generate(MacroAssembler* masm) { 1829 void CallFunctionStub::Generate(MacroAssembler* masm) {
1830 CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod()); 1830 CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod());
1831 } 1831 }
1832 1832
1833 1833
1834 void CallConstructStub::Generate(MacroAssembler* masm) { 1834 void CallConstructStub::Generate(MacroAssembler* masm) {
1835 // eax : number of arguments 1835 // eax : number of arguments
1836 // ebx : feedback vector 1836 // ebx : feedback vector
1837 // edx : (only if ebx is not the megamorphic symbol) slot in feedback 1837 // ecx : original constructor (for IsSuperConstructorCall)
1838 // vector (Smi) 1838 // edx : slot in feedback vector (Smi, for RecordCallTarget)
1839 // edi : constructor function 1839 // edi : constructor function
1840 Label slow, non_function_call; 1840 Label slow, non_function_call;
1841 1841
1842 if (IsSuperConstructorCall()) {
1843 __ push(ecx);
1844 }
1845
1842 // Check that function is not a smi. 1846 // Check that function is not a smi.
1843 __ JumpIfSmi(edi, &non_function_call); 1847 __ JumpIfSmi(edi, &non_function_call);
1844 // Check that function is a JSFunction. 1848 // Check that function is a JSFunction.
1845 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); 1849 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
1846 __ j(not_equal, &slow); 1850 __ j(not_equal, &slow);
1847 1851
1848 if (RecordCallTarget()) { 1852 if (RecordCallTarget()) {
1849 GenerateRecordCallTarget(masm); 1853 GenerateRecordCallTarget(masm);
1850 1854
1851 if (FLAG_pretenuring_call_new) { 1855 if (FLAG_pretenuring_call_new) {
(...skipping 12 matching lines...) Expand all
1864 __ cmp(FieldOperand(ebx, 0), Immediate(allocation_site_map)); 1868 __ cmp(FieldOperand(ebx, 0), Immediate(allocation_site_map));
1865 __ j(equal, &feedback_register_initialized); 1869 __ j(equal, &feedback_register_initialized);
1866 __ mov(ebx, isolate()->factory()->undefined_value()); 1870 __ mov(ebx, isolate()->factory()->undefined_value());
1867 __ bind(&feedback_register_initialized); 1871 __ bind(&feedback_register_initialized);
1868 } 1872 }
1869 1873
1870 __ AssertUndefinedOrAllocationSite(ebx); 1874 __ AssertUndefinedOrAllocationSite(ebx);
1871 } 1875 }
1872 1876
1873 if (IsSuperConstructorCall()) { 1877 if (IsSuperConstructorCall()) {
1874 __ mov(edx, Operand(esp, eax, times_pointer_size, 2 * kPointerSize)); 1878 __ pop(edx);
1875 } else { 1879 } else {
1876 // Pass original constructor to construct stub. 1880 // Pass original constructor to construct stub.
1877 __ mov(edx, edi); 1881 __ mov(edx, edi);
1878 } 1882 }
1879 1883
1880 // Jump to the function-specific construct stub. 1884 // Jump to the function-specific construct stub.
1881 Register jmp_reg = ecx; 1885 Register jmp_reg = ecx;
1882 __ mov(jmp_reg, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); 1886 __ mov(jmp_reg, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
1883 __ mov(jmp_reg, FieldOperand(jmp_reg, 1887 __ mov(jmp_reg, FieldOperand(jmp_reg,
1884 SharedFunctionInfo::kConstructStubOffset)); 1888 SharedFunctionInfo::kConstructStubOffset));
1885 __ lea(jmp_reg, FieldOperand(jmp_reg, Code::kHeaderSize)); 1889 __ lea(jmp_reg, FieldOperand(jmp_reg, Code::kHeaderSize));
1886 __ jmp(jmp_reg); 1890 __ jmp(jmp_reg);
1887 1891
1888 // edi: called object 1892 // edi: called object
1889 // eax: number of arguments 1893 // eax: number of arguments
1890 // ecx: object map 1894 // ecx: object map
1895 // esp[0]: original receiver
1891 Label do_call; 1896 Label do_call;
1892 __ bind(&slow); 1897 __ bind(&slow);
1893 __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE); 1898 __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE);
1894 __ j(not_equal, &non_function_call); 1899 __ j(not_equal, &non_function_call);
1895 __ GetBuiltinEntry(edx, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); 1900 __ GetBuiltinEntry(edx, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR);
1896 __ jmp(&do_call); 1901 __ jmp(&do_call);
1897 1902
1898 __ bind(&non_function_call); 1903 __ bind(&non_function_call);
1899 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); 1904 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR);
1900 __ bind(&do_call); 1905 __ bind(&do_call);
1906 if (IsSuperConstructorCall()) {
1907 __ Drop(1);
1908 }
1901 // Set expected number of arguments to zero (not changing eax). 1909 // Set expected number of arguments to zero (not changing eax).
1902 __ Move(ebx, Immediate(0)); 1910 __ Move(ebx, Immediate(0));
1903 Handle<Code> arguments_adaptor = 1911 Handle<Code> arguments_adaptor =
1904 isolate()->builtins()->ArgumentsAdaptorTrampoline(); 1912 isolate()->builtins()->ArgumentsAdaptorTrampoline();
1905 __ jmp(arguments_adaptor, RelocInfo::CODE_TARGET); 1913 __ jmp(arguments_adaptor, RelocInfo::CODE_TARGET);
1906 } 1914 }
1907 1915
1908 1916
1909 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { 1917 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) {
1910 __ mov(vector, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1918 __ mov(vector, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
(...skipping 3226 matching lines...) Expand 10 before | Expand all | Expand 10 after
5137 Operand(ebp, 7 * kPointerSize), NULL); 5145 Operand(ebp, 7 * kPointerSize), NULL);
5138 } 5146 }
5139 5147
5140 5148
5141 #undef __ 5149 #undef __
5142 5150
5143 } // namespace internal 5151 } // namespace internal
5144 } // namespace v8 5152 } // namespace v8
5145 5153
5146 #endif // V8_TARGET_ARCH_X87 5154 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/builtins-x87.cc ('k') | src/x87/full-codegen-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698