| 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_X87 | 5 #if V8_TARGET_ARCH_X87 |
| 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 4348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4359 __ LoadGlobalFunction(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, ecx); | 4359 __ LoadGlobalFunction(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, ecx); |
| 4360 __ mov(FieldOperand(edi, JSArray::kMapOffset), ecx); | 4360 __ mov(FieldOperand(edi, JSArray::kMapOffset), ecx); |
| 4361 __ mov(FieldOperand(edi, JSArray::kPropertiesOffset), | 4361 __ mov(FieldOperand(edi, JSArray::kPropertiesOffset), |
| 4362 isolate()->factory()->empty_fixed_array()); | 4362 isolate()->factory()->empty_fixed_array()); |
| 4363 __ mov(FieldOperand(edi, JSArray::kElementsOffset), edx); | 4363 __ mov(FieldOperand(edi, JSArray::kElementsOffset), edx); |
| 4364 __ mov(FieldOperand(edi, JSArray::kLengthOffset), eax); | 4364 __ mov(FieldOperand(edi, JSArray::kLengthOffset), eax); |
| 4365 STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize); | 4365 STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize); |
| 4366 __ mov(eax, edi); | 4366 __ mov(eax, edi); |
| 4367 __ Ret(); | 4367 __ Ret(); |
| 4368 | 4368 |
| 4369 // Fall back to %AllocateInNewSpace. | 4369 // Fall back to %AllocateInNewSpace (if not too big). |
| 4370 Label too_big_for_new_space; |
| 4370 __ bind(&allocate); | 4371 __ bind(&allocate); |
| 4372 __ cmp(ecx, Immediate(Page::kMaxRegularHeapObjectSize)); |
| 4373 __ j(greater, &too_big_for_new_space); |
| 4371 { | 4374 { |
| 4372 FrameScope scope(masm, StackFrame::INTERNAL); | 4375 FrameScope scope(masm, StackFrame::INTERNAL); |
| 4373 __ SmiTag(ecx); | 4376 __ SmiTag(ecx); |
| 4374 __ Push(eax); | 4377 __ Push(eax); |
| 4375 __ Push(ebx); | 4378 __ Push(ebx); |
| 4376 __ Push(ecx); | 4379 __ Push(ecx); |
| 4377 __ CallRuntime(Runtime::kAllocateInNewSpace); | 4380 __ CallRuntime(Runtime::kAllocateInNewSpace); |
| 4378 __ mov(edx, eax); | 4381 __ mov(edx, eax); |
| 4379 __ Pop(ebx); | 4382 __ Pop(ebx); |
| 4380 __ Pop(eax); | 4383 __ Pop(eax); |
| 4381 } | 4384 } |
| 4382 __ jmp(&done_allocate); | 4385 __ jmp(&done_allocate); |
| 4386 |
| 4387 // Fall back to %NewRestParameter. |
| 4388 __ bind(&too_big_for_new_space); |
| 4389 __ PopReturnAddressTo(ecx); |
| 4390 // We reload the function from the caller frame due to register pressure |
| 4391 // within this stub. This is the slow path, hence reloading is preferable. |
| 4392 if (skip_stub_frame()) { |
| 4393 // For Ignition we need to skip the handler/stub frame to reach the |
| 4394 // JavaScript frame for the function. |
| 4395 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
| 4396 __ Push(Operand(edx, StandardFrameConstants::kFunctionOffset)); |
| 4397 } else { |
| 4398 __ Push(Operand(ebp, StandardFrameConstants::kFunctionOffset)); |
| 4399 } |
| 4400 __ PushReturnAddressFrom(ecx); |
| 4401 __ TailCallRuntime(Runtime::kNewRestParameter); |
| 4383 } | 4402 } |
| 4384 } | 4403 } |
| 4385 | 4404 |
| 4386 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { | 4405 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { |
| 4387 // ----------- S t a t e ------------- | 4406 // ----------- S t a t e ------------- |
| 4388 // -- edi : function | 4407 // -- edi : function |
| 4389 // -- esi : context | 4408 // -- esi : context |
| 4390 // -- ebp : frame pointer | 4409 // -- ebp : frame pointer |
| 4391 // -- esp[0] : return address | 4410 // -- esp[0] : return address |
| 4392 // ----------------------------------- | 4411 // ----------------------------------- |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4727 __ LoadGlobalFunction(Context::STRICT_ARGUMENTS_MAP_INDEX, ecx); | 4746 __ LoadGlobalFunction(Context::STRICT_ARGUMENTS_MAP_INDEX, ecx); |
| 4728 __ mov(FieldOperand(edi, JSStrictArgumentsObject::kMapOffset), ecx); | 4747 __ mov(FieldOperand(edi, JSStrictArgumentsObject::kMapOffset), ecx); |
| 4729 __ mov(FieldOperand(edi, JSStrictArgumentsObject::kPropertiesOffset), | 4748 __ mov(FieldOperand(edi, JSStrictArgumentsObject::kPropertiesOffset), |
| 4730 isolate()->factory()->empty_fixed_array()); | 4749 isolate()->factory()->empty_fixed_array()); |
| 4731 __ mov(FieldOperand(edi, JSStrictArgumentsObject::kElementsOffset), edx); | 4750 __ mov(FieldOperand(edi, JSStrictArgumentsObject::kElementsOffset), edx); |
| 4732 __ mov(FieldOperand(edi, JSStrictArgumentsObject::kLengthOffset), eax); | 4751 __ mov(FieldOperand(edi, JSStrictArgumentsObject::kLengthOffset), eax); |
| 4733 STATIC_ASSERT(JSStrictArgumentsObject::kSize == 4 * kPointerSize); | 4752 STATIC_ASSERT(JSStrictArgumentsObject::kSize == 4 * kPointerSize); |
| 4734 __ mov(eax, edi); | 4753 __ mov(eax, edi); |
| 4735 __ Ret(); | 4754 __ Ret(); |
| 4736 | 4755 |
| 4737 // Fall back to %AllocateInNewSpace. | 4756 // Fall back to %AllocateInNewSpace (if not too big). |
| 4757 Label too_big_for_new_space; |
| 4738 __ bind(&allocate); | 4758 __ bind(&allocate); |
| 4759 __ cmp(ecx, Immediate(Page::kMaxRegularHeapObjectSize)); |
| 4760 __ j(greater, &too_big_for_new_space); |
| 4739 { | 4761 { |
| 4740 FrameScope scope(masm, StackFrame::INTERNAL); | 4762 FrameScope scope(masm, StackFrame::INTERNAL); |
| 4741 __ SmiTag(ecx); | 4763 __ SmiTag(ecx); |
| 4742 __ Push(eax); | 4764 __ Push(eax); |
| 4743 __ Push(ebx); | 4765 __ Push(ebx); |
| 4744 __ Push(ecx); | 4766 __ Push(ecx); |
| 4745 __ CallRuntime(Runtime::kAllocateInNewSpace); | 4767 __ CallRuntime(Runtime::kAllocateInNewSpace); |
| 4746 __ mov(edx, eax); | 4768 __ mov(edx, eax); |
| 4747 __ Pop(ebx); | 4769 __ Pop(ebx); |
| 4748 __ Pop(eax); | 4770 __ Pop(eax); |
| 4749 } | 4771 } |
| 4750 __ jmp(&done_allocate); | 4772 __ jmp(&done_allocate); |
| 4773 |
| 4774 // Fall back to %NewStrictArguments. |
| 4775 __ bind(&too_big_for_new_space); |
| 4776 __ PopReturnAddressTo(ecx); |
| 4777 // We reload the function from the caller frame due to register pressure |
| 4778 // within this stub. This is the slow path, hence reloading is preferable. |
| 4779 if (skip_stub_frame()) { |
| 4780 // For Ignition we need to skip the handler/stub frame to reach the |
| 4781 // JavaScript frame for the function. |
| 4782 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
| 4783 __ Push(Operand(edx, StandardFrameConstants::kFunctionOffset)); |
| 4784 } else { |
| 4785 __ Push(Operand(ebp, StandardFrameConstants::kFunctionOffset)); |
| 4786 } |
| 4787 __ PushReturnAddressFrom(ecx); |
| 4788 __ TailCallRuntime(Runtime::kNewStrictArguments); |
| 4751 } | 4789 } |
| 4752 | 4790 |
| 4753 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { | 4791 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { |
| 4754 Register context_reg = esi; | 4792 Register context_reg = esi; |
| 4755 Register slot_reg = ebx; | 4793 Register slot_reg = ebx; |
| 4756 Register value_reg = eax; | 4794 Register value_reg = eax; |
| 4757 Register cell_reg = edi; | 4795 Register cell_reg = edi; |
| 4758 Register cell_details_reg = edx; | 4796 Register cell_details_reg = edx; |
| 4759 Register cell_value_reg = ecx; | 4797 Register cell_value_reg = ecx; |
| 4760 Label fast_heapobject_case, fast_smi_case, slow_case; | 4798 Label fast_heapobject_case, fast_smi_case, slow_case; |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5250 kStackUnwindSpace, nullptr, return_value_operand, | 5288 kStackUnwindSpace, nullptr, return_value_operand, |
| 5251 NULL); | 5289 NULL); |
| 5252 } | 5290 } |
| 5253 | 5291 |
| 5254 #undef __ | 5292 #undef __ |
| 5255 | 5293 |
| 5256 } // namespace internal | 5294 } // namespace internal |
| 5257 } // namespace v8 | 5295 } // namespace v8 |
| 5258 | 5296 |
| 5259 #endif // V8_TARGET_ARCH_X87 | 5297 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |