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

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

Issue 908883002: new classes: implement new.target passing to superclass constructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix x64 arithmetic Created 5 years, 10 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/ia32/builtins-ia32.cc ('k') | src/ia32/deoptimizer-ia32.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_IA32 7 #if V8_TARGET_ARCH_IA32
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 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 StubRuntimeCallHelper call_helper; 731 StubRuntimeCallHelper call_helper;
732 char_at_generator.GenerateSlow(masm, call_helper); 732 char_at_generator.GenerateSlow(masm, call_helper);
733 733
734 __ bind(&miss); 734 __ bind(&miss);
735 PropertyAccessCompiler::TailCallBuiltin( 735 PropertyAccessCompiler::TailCallBuiltin(
736 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); 736 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC));
737 } 737 }
738 738
739 739
740 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { 740 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
741 CHECK(!has_new_target());
741 // The key is in edx and the parameter count is in eax. 742 // The key is in edx and the parameter count is in eax.
742 DCHECK(edx.is(ArgumentsAccessReadDescriptor::index())); 743 DCHECK(edx.is(ArgumentsAccessReadDescriptor::index()));
743 DCHECK(eax.is(ArgumentsAccessReadDescriptor::parameter_count())); 744 DCHECK(eax.is(ArgumentsAccessReadDescriptor::parameter_count()));
744 745
745 // The displacement is used for skipping the frame pointer on the 746 // The displacement is used for skipping the frame pointer on the
746 // stack. It is the offset of the last parameter (if any) relative 747 // stack. It is the offset of the last parameter (if any) relative
747 // to the frame pointer. 748 // to the frame pointer.
748 static const int kDisplacement = 1 * kPointerSize; 749 static const int kDisplacement = 1 * kPointerSize;
749 750
750 // Check that the key is a smi. 751 // Check that the key is a smi.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 __ TailCallRuntime(Runtime::kGetArgumentsProperty, 1, 1); 798 __ TailCallRuntime(Runtime::kGetArgumentsProperty, 1, 1);
798 } 799 }
799 800
800 801
801 void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { 802 void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) {
802 // esp[0] : return address 803 // esp[0] : return address
803 // esp[4] : number of parameters 804 // esp[4] : number of parameters
804 // esp[8] : receiver displacement 805 // esp[8] : receiver displacement
805 // esp[12] : function 806 // esp[12] : function
806 807
808 CHECK(!has_new_target());
809
807 // Check if the calling frame is an arguments adaptor frame. 810 // Check if the calling frame is an arguments adaptor frame.
808 Label runtime; 811 Label runtime;
809 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); 812 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
810 __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset)); 813 __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset));
811 __ cmp(ecx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 814 __ cmp(ecx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
812 __ j(not_equal, &runtime, Label::kNear); 815 __ j(not_equal, &runtime, Label::kNear);
813 816
814 // Patch the arguments.length and the parameters pointer. 817 // Patch the arguments.length and the parameters pointer.
815 __ mov(ecx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset)); 818 __ mov(ecx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset));
816 __ mov(Operand(esp, 1 * kPointerSize), ecx); 819 __ mov(Operand(esp, 1 * kPointerSize), ecx);
817 __ lea(edx, Operand(edx, ecx, times_2, 820 __ lea(edx, Operand(edx, ecx, times_2,
818 StandardFrameConstants::kCallerSPOffset)); 821 StandardFrameConstants::kCallerSPOffset));
819 __ mov(Operand(esp, 2 * kPointerSize), edx); 822 __ mov(Operand(esp, 2 * kPointerSize), edx);
820 823
821 __ bind(&runtime); 824 __ bind(&runtime);
822 __ TailCallRuntime(Runtime::kNewSloppyArguments, 3, 1); 825 __ TailCallRuntime(Runtime::kNewSloppyArguments, 3, 1);
823 } 826 }
824 827
825 828
826 void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { 829 void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) {
827 // esp[0] : return address 830 // esp[0] : return address
828 // esp[4] : number of parameters (tagged) 831 // esp[4] : number of parameters (tagged)
829 // esp[8] : receiver displacement 832 // esp[8] : receiver displacement
830 // esp[12] : function 833 // esp[12] : function
831 834
832 // ebx = parameter count (tagged) 835 // ebx = parameter count (tagged)
833 __ mov(ebx, Operand(esp, 1 * kPointerSize)); 836 __ mov(ebx, Operand(esp, 1 * kPointerSize));
834 837
838 CHECK(!has_new_target());
839
835 // Check if the calling frame is an arguments adaptor frame. 840 // Check if the calling frame is an arguments adaptor frame.
836 // TODO(rossberg): Factor out some of the bits that are shared with the other 841 // TODO(rossberg): Factor out some of the bits that are shared with the other
837 // Generate* functions. 842 // Generate* functions.
838 Label runtime; 843 Label runtime;
839 Label adaptor_frame, try_allocate; 844 Label adaptor_frame, try_allocate;
840 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); 845 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
841 __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset)); 846 __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset));
842 __ cmp(ecx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 847 __ cmp(ecx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
843 __ j(equal, &adaptor_frame, Label::kNear); 848 __ j(equal, &adaptor_frame, Label::kNear);
844 849
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 __ cmp(ecx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 1069 __ cmp(ecx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
1065 __ j(equal, &adaptor_frame, Label::kNear); 1070 __ j(equal, &adaptor_frame, Label::kNear);
1066 1071
1067 // Get the length from the frame. 1072 // Get the length from the frame.
1068 __ mov(ecx, Operand(esp, 1 * kPointerSize)); 1073 __ mov(ecx, Operand(esp, 1 * kPointerSize));
1069 __ jmp(&try_allocate, Label::kNear); 1074 __ jmp(&try_allocate, Label::kNear);
1070 1075
1071 // Patch the arguments.length and the parameters pointer. 1076 // Patch the arguments.length and the parameters pointer.
1072 __ bind(&adaptor_frame); 1077 __ bind(&adaptor_frame);
1073 __ mov(ecx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset)); 1078 __ mov(ecx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset));
1074 __ mov(Operand(esp, 1 * kPointerSize), ecx); 1079
1080 if (has_new_target()) {
1081 // Subtract 1 from smi-tagged arguments count.
1082 __ sub(ecx, Immediate(2));
1083 }
1084
1075 __ lea(edx, Operand(edx, ecx, times_2, 1085 __ lea(edx, Operand(edx, ecx, times_2,
1076 StandardFrameConstants::kCallerSPOffset)); 1086 StandardFrameConstants::kCallerSPOffset));
1087 __ mov(Operand(esp, 1 * kPointerSize), ecx);
1077 __ mov(Operand(esp, 2 * kPointerSize), edx); 1088 __ mov(Operand(esp, 2 * kPointerSize), edx);
1078 1089
1079 // Try the new space allocation. Start out with computing the size of 1090 // Try the new space allocation. Start out with computing the size of
1080 // the arguments object and the elements array. 1091 // the arguments object and the elements array.
1081 Label add_arguments_object; 1092 Label add_arguments_object;
1082 __ bind(&try_allocate); 1093 __ bind(&try_allocate);
1083 __ test(ecx, ecx); 1094 __ test(ecx, ecx);
1084 __ j(zero, &add_arguments_object, Label::kNear); 1095 __ j(zero, &add_arguments_object, Label::kNear);
1085 __ lea(ecx, Operand(ecx, times_2, FixedArray::kHeaderSize)); 1096 __ lea(ecx, Operand(ecx, times_2, FixedArray::kHeaderSize));
1086 __ bind(&add_arguments_object); 1097 __ bind(&add_arguments_object);
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
2142 isolate()->factory()->allocation_site_map(); 2153 isolate()->factory()->allocation_site_map();
2143 __ cmp(FieldOperand(ebx, 0), Immediate(allocation_site_map)); 2154 __ cmp(FieldOperand(ebx, 0), Immediate(allocation_site_map));
2144 __ j(equal, &feedback_register_initialized); 2155 __ j(equal, &feedback_register_initialized);
2145 __ mov(ebx, isolate()->factory()->undefined_value()); 2156 __ mov(ebx, isolate()->factory()->undefined_value());
2146 __ bind(&feedback_register_initialized); 2157 __ bind(&feedback_register_initialized);
2147 } 2158 }
2148 2159
2149 __ AssertUndefinedOrAllocationSite(ebx); 2160 __ AssertUndefinedOrAllocationSite(ebx);
2150 } 2161 }
2151 2162
2152 // Pass original constructor to construct stub. 2163 if (IsSuperConstructorCall()) {
2153 __ mov(edx, edi); 2164 __ mov(edx, Operand(esp, eax, times_pointer_size, 2 * kPointerSize));
2165 } else {
2166 // Pass original constructor to construct stub.
2167 __ mov(edx, edi);
2168 }
2154 2169
2155 // Jump to the function-specific construct stub. 2170 // Jump to the function-specific construct stub.
2156 Register jmp_reg = ecx; 2171 Register jmp_reg = ecx;
2157 __ mov(jmp_reg, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); 2172 __ mov(jmp_reg, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
2158 __ mov(jmp_reg, FieldOperand(jmp_reg, 2173 __ mov(jmp_reg, FieldOperand(jmp_reg,
2159 SharedFunctionInfo::kConstructStubOffset)); 2174 SharedFunctionInfo::kConstructStubOffset));
2160 __ lea(jmp_reg, FieldOperand(jmp_reg, Code::kHeaderSize)); 2175 __ lea(jmp_reg, FieldOperand(jmp_reg, Code::kHeaderSize));
2161 __ jmp(jmp_reg); 2176 __ jmp(jmp_reg);
2162 2177
2163 // edi: called object 2178 // edi: called object
(...skipping 2934 matching lines...) Expand 10 before | Expand all | Expand 10 after
5098 ApiParameterOperand(2), kStackSpace, nullptr, 5113 ApiParameterOperand(2), kStackSpace, nullptr,
5099 Operand(ebp, 7 * kPointerSize), NULL); 5114 Operand(ebp, 7 * kPointerSize), NULL);
5100 } 5115 }
5101 5116
5102 5117
5103 #undef __ 5118 #undef __
5104 5119
5105 } } // namespace v8::internal 5120 } } // namespace v8::internal
5106 5121
5107 #endif // V8_TARGET_ARCH_IA32 5122 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/ia32/deoptimizer-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698