OLD | NEW |
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 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 StubRuntimeCallHelper call_helper; | 726 StubRuntimeCallHelper call_helper; |
727 char_at_generator.GenerateSlow(masm, PART_OF_IC_HANDLER, call_helper); | 727 char_at_generator.GenerateSlow(masm, PART_OF_IC_HANDLER, call_helper); |
728 | 728 |
729 __ bind(&miss); | 729 __ bind(&miss); |
730 PropertyAccessCompiler::TailCallBuiltin( | 730 PropertyAccessCompiler::TailCallBuiltin( |
731 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); | 731 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); |
732 } | 732 } |
733 | 733 |
734 | 734 |
735 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { | 735 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { |
736 CHECK(!has_new_target()); | |
737 // The key is in edx and the parameter count is in eax. | 736 // The key is in edx and the parameter count is in eax. |
738 DCHECK(edx.is(ArgumentsAccessReadDescriptor::index())); | 737 DCHECK(edx.is(ArgumentsAccessReadDescriptor::index())); |
739 DCHECK(eax.is(ArgumentsAccessReadDescriptor::parameter_count())); | 738 DCHECK(eax.is(ArgumentsAccessReadDescriptor::parameter_count())); |
740 | 739 |
741 // The displacement is used for skipping the frame pointer on the | 740 // The displacement is used for skipping the frame pointer on the |
742 // stack. It is the offset of the last parameter (if any) relative | 741 // stack. It is the offset of the last parameter (if any) relative |
743 // to the frame pointer. | 742 // to the frame pointer. |
744 static const int kDisplacement = 1 * kPointerSize; | 743 static const int kDisplacement = 1 * kPointerSize; |
745 | 744 |
746 // Check that the key is a smi. | 745 // Check that the key is a smi. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 __ TailCallRuntime(Runtime::kGetArgumentsProperty, 1, 1); | 792 __ TailCallRuntime(Runtime::kGetArgumentsProperty, 1, 1); |
794 } | 793 } |
795 | 794 |
796 | 795 |
797 void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { | 796 void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { |
798 // esp[0] : return address | 797 // esp[0] : return address |
799 // esp[4] : number of parameters | 798 // esp[4] : number of parameters |
800 // esp[8] : receiver displacement | 799 // esp[8] : receiver displacement |
801 // esp[12] : function | 800 // esp[12] : function |
802 | 801 |
803 CHECK(!has_new_target()); | |
804 | |
805 // Check if the calling frame is an arguments adaptor frame. | 802 // Check if the calling frame is an arguments adaptor frame. |
806 Label runtime; | 803 Label runtime; |
807 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); | 804 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
808 __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset)); | 805 __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset)); |
809 __ cmp(ecx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 806 __ cmp(ecx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
810 __ j(not_equal, &runtime, Label::kNear); | 807 __ j(not_equal, &runtime, Label::kNear); |
811 | 808 |
812 // Patch the arguments.length and the parameters pointer. | 809 // Patch the arguments.length and the parameters pointer. |
813 __ mov(ecx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 810 __ mov(ecx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
814 __ mov(Operand(esp, 1 * kPointerSize), ecx); | 811 __ mov(Operand(esp, 1 * kPointerSize), ecx); |
815 __ lea(edx, Operand(edx, ecx, times_2, | 812 __ lea(edx, Operand(edx, ecx, times_2, |
816 StandardFrameConstants::kCallerSPOffset)); | 813 StandardFrameConstants::kCallerSPOffset)); |
817 __ mov(Operand(esp, 2 * kPointerSize), edx); | 814 __ mov(Operand(esp, 2 * kPointerSize), edx); |
818 | 815 |
819 __ bind(&runtime); | 816 __ bind(&runtime); |
820 __ TailCallRuntime(Runtime::kNewSloppyArguments, 3, 1); | 817 __ TailCallRuntime(Runtime::kNewSloppyArguments, 3, 1); |
821 } | 818 } |
822 | 819 |
823 | 820 |
824 void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { | 821 void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { |
825 // esp[0] : return address | 822 // esp[0] : return address |
826 // esp[4] : number of parameters (tagged) | 823 // esp[4] : number of parameters (tagged) |
827 // esp[8] : receiver displacement | 824 // esp[8] : receiver displacement |
828 // esp[12] : function | 825 // esp[12] : function |
829 | 826 |
830 // ebx = parameter count (tagged) | 827 // ebx = parameter count (tagged) |
831 __ mov(ebx, Operand(esp, 1 * kPointerSize)); | 828 __ mov(ebx, Operand(esp, 1 * kPointerSize)); |
832 | 829 |
833 CHECK(!has_new_target()); | |
834 | |
835 // Check if the calling frame is an arguments adaptor frame. | 830 // 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 | 831 // TODO(rossberg): Factor out some of the bits that are shared with the other |
837 // Generate* functions. | 832 // Generate* functions. |
838 Label runtime; | 833 Label runtime; |
839 Label adaptor_frame, try_allocate; | 834 Label adaptor_frame, try_allocate; |
840 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); | 835 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
841 __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset)); | 836 __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset)); |
842 __ cmp(ecx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 837 __ cmp(ecx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
843 __ j(equal, &adaptor_frame, Label::kNear); | 838 __ j(equal, &adaptor_frame, Label::kNear); |
844 | 839 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 __ j(equal, &adaptor_frame, Label::kNear); | 1060 __ j(equal, &adaptor_frame, Label::kNear); |
1066 | 1061 |
1067 // Get the length from the frame. | 1062 // Get the length from the frame. |
1068 __ mov(ecx, Operand(esp, 1 * kPointerSize)); | 1063 __ mov(ecx, Operand(esp, 1 * kPointerSize)); |
1069 __ jmp(&try_allocate, Label::kNear); | 1064 __ jmp(&try_allocate, Label::kNear); |
1070 | 1065 |
1071 // Patch the arguments.length and the parameters pointer. | 1066 // Patch the arguments.length and the parameters pointer. |
1072 __ bind(&adaptor_frame); | 1067 __ bind(&adaptor_frame); |
1073 __ mov(ecx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 1068 __ mov(ecx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
1074 | 1069 |
1075 if (has_new_target()) { | |
1076 // If the constructor was [[Call]]ed, the call will not push a new.target | |
1077 // onto the stack. In that case the arguments array we construct is bogus, | |
1078 // bu we do not care as the constructor throws immediately. | |
1079 __ cmp(ecx, Immediate(Smi::FromInt(0))); | |
1080 Label skip_decrement; | |
1081 __ j(equal, &skip_decrement); | |
1082 // Subtract 1 from smi-tagged arguments count. | |
1083 __ sub(ecx, Immediate(2)); | |
1084 __ bind(&skip_decrement); | |
1085 } | |
1086 | |
1087 __ lea(edx, Operand(edx, ecx, times_2, | 1070 __ lea(edx, Operand(edx, ecx, times_2, |
1088 StandardFrameConstants::kCallerSPOffset)); | 1071 StandardFrameConstants::kCallerSPOffset)); |
1089 __ mov(Operand(esp, 1 * kPointerSize), ecx); | 1072 __ mov(Operand(esp, 1 * kPointerSize), ecx); |
1090 __ mov(Operand(esp, 2 * kPointerSize), edx); | 1073 __ mov(Operand(esp, 2 * kPointerSize), edx); |
1091 | 1074 |
1092 // Try the new space allocation. Start out with computing the size of | 1075 // Try the new space allocation. Start out with computing the size of |
1093 // the arguments object and the elements array. | 1076 // the arguments object and the elements array. |
1094 Label add_arguments_object; | 1077 Label add_arguments_object; |
1095 __ bind(&try_allocate); | 1078 __ bind(&try_allocate); |
1096 __ test(ecx, ecx); | 1079 __ test(ecx, ecx); |
(...skipping 4381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5478 Operand(ebp, 7 * kPointerSize), NULL); | 5461 Operand(ebp, 7 * kPointerSize), NULL); |
5479 } | 5462 } |
5480 | 5463 |
5481 | 5464 |
5482 #undef __ | 5465 #undef __ |
5483 | 5466 |
5484 } // namespace internal | 5467 } // namespace internal |
5485 } // namespace v8 | 5468 } // namespace v8 |
5486 | 5469 |
5487 #endif // V8_TARGET_ARCH_IA32 | 5470 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |