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 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 4766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4777 __ LoadGlobalFunction(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, ecx); | 4777 __ LoadGlobalFunction(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, ecx); |
4778 __ mov(FieldOperand(edi, JSArray::kMapOffset), ecx); | 4778 __ mov(FieldOperand(edi, JSArray::kMapOffset), ecx); |
4779 __ mov(FieldOperand(edi, JSArray::kPropertiesOffset), | 4779 __ mov(FieldOperand(edi, JSArray::kPropertiesOffset), |
4780 isolate()->factory()->empty_fixed_array()); | 4780 isolate()->factory()->empty_fixed_array()); |
4781 __ mov(FieldOperand(edi, JSArray::kElementsOffset), edx); | 4781 __ mov(FieldOperand(edi, JSArray::kElementsOffset), edx); |
4782 __ mov(FieldOperand(edi, JSArray::kLengthOffset), eax); | 4782 __ mov(FieldOperand(edi, JSArray::kLengthOffset), eax); |
4783 STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize); | 4783 STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize); |
4784 __ mov(eax, edi); | 4784 __ mov(eax, edi); |
4785 __ Ret(); | 4785 __ Ret(); |
4786 | 4786 |
4787 // Fall back to %AllocateInNewSpace. | 4787 // Fall back to %AllocateInNewSpace (if not too big). |
| 4788 Label too_big_for_new_space; |
4788 __ bind(&allocate); | 4789 __ bind(&allocate); |
| 4790 __ cmp(ecx, Immediate(Page::kMaxRegularHeapObjectSize)); |
| 4791 __ j(greater, &too_big_for_new_space); |
4789 { | 4792 { |
4790 FrameScope scope(masm, StackFrame::INTERNAL); | 4793 FrameScope scope(masm, StackFrame::INTERNAL); |
4791 __ SmiTag(ecx); | 4794 __ SmiTag(ecx); |
4792 __ Push(eax); | 4795 __ Push(eax); |
4793 __ Push(ebx); | 4796 __ Push(ebx); |
4794 __ Push(ecx); | 4797 __ Push(ecx); |
4795 __ CallRuntime(Runtime::kAllocateInNewSpace); | 4798 __ CallRuntime(Runtime::kAllocateInNewSpace); |
4796 __ mov(edx, eax); | 4799 __ mov(edx, eax); |
4797 __ Pop(ebx); | 4800 __ Pop(ebx); |
4798 __ Pop(eax); | 4801 __ Pop(eax); |
4799 } | 4802 } |
4800 __ jmp(&done_allocate); | 4803 __ jmp(&done_allocate); |
| 4804 |
| 4805 // Fall back to %NewRestParameter. |
| 4806 __ bind(&too_big_for_new_space); |
| 4807 __ PopReturnAddressTo(ecx); |
| 4808 // We reload the function from the caller frame due to register pressure |
| 4809 // within this stub. This is the slow path, hence reloading is preferable. |
| 4810 if (skip_stub_frame()) { |
| 4811 // For Ignition we need to skip the handler/stub frame to reach the |
| 4812 // JavaScript frame for the function. |
| 4813 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
| 4814 __ Push(Operand(edx, StandardFrameConstants::kFunctionOffset)); |
| 4815 } else { |
| 4816 __ Push(Operand(ebp, StandardFrameConstants::kFunctionOffset)); |
| 4817 } |
| 4818 __ PushReturnAddressFrom(ecx); |
| 4819 __ TailCallRuntime(Runtime::kNewRestParameter); |
4801 } | 4820 } |
4802 } | 4821 } |
4803 | 4822 |
4804 | 4823 |
4805 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { | 4824 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { |
4806 // ----------- S t a t e ------------- | 4825 // ----------- S t a t e ------------- |
4807 // -- edi : function | 4826 // -- edi : function |
4808 // -- esi : context | 4827 // -- esi : context |
4809 // -- ebp : frame pointer | 4828 // -- ebp : frame pointer |
4810 // -- esp[0] : return address | 4829 // -- esp[0] : return address |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5147 __ LoadGlobalFunction(Context::STRICT_ARGUMENTS_MAP_INDEX, ecx); | 5166 __ LoadGlobalFunction(Context::STRICT_ARGUMENTS_MAP_INDEX, ecx); |
5148 __ mov(FieldOperand(edi, JSStrictArgumentsObject::kMapOffset), ecx); | 5167 __ mov(FieldOperand(edi, JSStrictArgumentsObject::kMapOffset), ecx); |
5149 __ mov(FieldOperand(edi, JSStrictArgumentsObject::kPropertiesOffset), | 5168 __ mov(FieldOperand(edi, JSStrictArgumentsObject::kPropertiesOffset), |
5150 isolate()->factory()->empty_fixed_array()); | 5169 isolate()->factory()->empty_fixed_array()); |
5151 __ mov(FieldOperand(edi, JSStrictArgumentsObject::kElementsOffset), edx); | 5170 __ mov(FieldOperand(edi, JSStrictArgumentsObject::kElementsOffset), edx); |
5152 __ mov(FieldOperand(edi, JSStrictArgumentsObject::kLengthOffset), eax); | 5171 __ mov(FieldOperand(edi, JSStrictArgumentsObject::kLengthOffset), eax); |
5153 STATIC_ASSERT(JSStrictArgumentsObject::kSize == 4 * kPointerSize); | 5172 STATIC_ASSERT(JSStrictArgumentsObject::kSize == 4 * kPointerSize); |
5154 __ mov(eax, edi); | 5173 __ mov(eax, edi); |
5155 __ Ret(); | 5174 __ Ret(); |
5156 | 5175 |
5157 // Fall back to %AllocateInNewSpace. | 5176 // Fall back to %AllocateInNewSpace (if not too big). |
| 5177 Label too_big_for_new_space; |
5158 __ bind(&allocate); | 5178 __ bind(&allocate); |
| 5179 __ cmp(ecx, Immediate(Page::kMaxRegularHeapObjectSize)); |
| 5180 __ j(greater, &too_big_for_new_space); |
5159 { | 5181 { |
5160 FrameScope scope(masm, StackFrame::INTERNAL); | 5182 FrameScope scope(masm, StackFrame::INTERNAL); |
5161 __ SmiTag(ecx); | 5183 __ SmiTag(ecx); |
5162 __ Push(eax); | 5184 __ Push(eax); |
5163 __ Push(ebx); | 5185 __ Push(ebx); |
5164 __ Push(ecx); | 5186 __ Push(ecx); |
5165 __ CallRuntime(Runtime::kAllocateInNewSpace); | 5187 __ CallRuntime(Runtime::kAllocateInNewSpace); |
5166 __ mov(edx, eax); | 5188 __ mov(edx, eax); |
5167 __ Pop(ebx); | 5189 __ Pop(ebx); |
5168 __ Pop(eax); | 5190 __ Pop(eax); |
5169 } | 5191 } |
5170 __ jmp(&done_allocate); | 5192 __ jmp(&done_allocate); |
| 5193 |
| 5194 // Fall back to %NewStrictArguments. |
| 5195 __ bind(&too_big_for_new_space); |
| 5196 __ PopReturnAddressTo(ecx); |
| 5197 // We reload the function from the caller frame due to register pressure |
| 5198 // within this stub. This is the slow path, hence reloading is preferable. |
| 5199 if (skip_stub_frame()) { |
| 5200 // For Ignition we need to skip the handler/stub frame to reach the |
| 5201 // JavaScript frame for the function. |
| 5202 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
| 5203 __ Push(Operand(edx, StandardFrameConstants::kFunctionOffset)); |
| 5204 } else { |
| 5205 __ Push(Operand(ebp, StandardFrameConstants::kFunctionOffset)); |
| 5206 } |
| 5207 __ PushReturnAddressFrom(ecx); |
| 5208 __ TailCallRuntime(Runtime::kNewStrictArguments); |
5171 } | 5209 } |
5172 | 5210 |
5173 | 5211 |
5174 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) { | 5212 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) { |
5175 Register context_reg = esi; | 5213 Register context_reg = esi; |
5176 Register slot_reg = ebx; | 5214 Register slot_reg = ebx; |
5177 Register result_reg = eax; | 5215 Register result_reg = eax; |
5178 Label slow_case; | 5216 Label slow_case; |
5179 | 5217 |
5180 // Go up context chain to the script context. | 5218 // Go up context chain to the script context. |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5702 kStackUnwindSpace, nullptr, return_value_operand, | 5740 kStackUnwindSpace, nullptr, return_value_operand, |
5703 NULL); | 5741 NULL); |
5704 } | 5742 } |
5705 | 5743 |
5706 #undef __ | 5744 #undef __ |
5707 | 5745 |
5708 } // namespace internal | 5746 } // namespace internal |
5709 } // namespace v8 | 5747 } // namespace v8 |
5710 | 5748 |
5711 #endif // V8_TARGET_ARCH_IA32 | 5749 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |