| OLD | NEW | 
|---|
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_S390 | 5 #if V8_TARGET_ARCH_S390 | 
| 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 4517 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4528   Label no_rest_parameters; | 4528   Label no_rest_parameters; | 
| 4529   __ LoadP(r4, MemOperand(r4, StandardFrameConstants::kCallerFPOffset)); | 4529   __ LoadP(r4, MemOperand(r4, StandardFrameConstants::kCallerFPOffset)); | 
| 4530   __ LoadP(ip, MemOperand(r4, CommonFrameConstants::kContextOrFrameTypeOffset)); | 4530   __ LoadP(ip, MemOperand(r4, CommonFrameConstants::kContextOrFrameTypeOffset)); | 
| 4531   __ CmpSmiLiteral(ip, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); | 4531   __ CmpSmiLiteral(ip, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); | 
| 4532   __ bne(&no_rest_parameters); | 4532   __ bne(&no_rest_parameters); | 
| 4533 | 4533 | 
| 4534   // Check if the arguments adaptor frame contains more arguments than | 4534   // Check if the arguments adaptor frame contains more arguments than | 
| 4535   // specified by the function's internal formal parameter count. | 4535   // specified by the function's internal formal parameter count. | 
| 4536   Label rest_parameters; | 4536   Label rest_parameters; | 
| 4537   __ LoadP(r2, MemOperand(r4, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 4537   __ LoadP(r2, MemOperand(r4, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 
| 4538   __ LoadP(r3, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset)); | 4538   __ LoadP(r5, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset)); | 
| 4539   __ LoadW( | 4539   __ LoadW( | 
| 4540       r3, FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset)); | 4540       r5, FieldMemOperand(r5, SharedFunctionInfo::kFormalParameterCountOffset)); | 
| 4541 #if V8_TARGET_ARCH_S390X | 4541 #if V8_TARGET_ARCH_S390X | 
| 4542   __ SmiTag(r3); | 4542   __ SmiTag(r5); | 
| 4543 #endif | 4543 #endif | 
| 4544   __ SubP(r2, r2, r3); | 4544   __ SubP(r2, r2, r5); | 
| 4545   __ bgt(&rest_parameters); | 4545   __ bgt(&rest_parameters); | 
| 4546 | 4546 | 
| 4547   // Return an empty rest parameter array. | 4547   // Return an empty rest parameter array. | 
| 4548   __ bind(&no_rest_parameters); | 4548   __ bind(&no_rest_parameters); | 
| 4549   { | 4549   { | 
| 4550     // ----------- S t a t e ------------- | 4550     // ----------- S t a t e ------------- | 
| 4551     //  -- cp : context | 4551     //  -- cp : context | 
| 4552     //  -- lr : return address | 4552     //  -- lr : return address | 
| 4553     // ----------------------------------- | 4553     // ----------------------------------- | 
| 4554 | 4554 | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
| 4581   __ bind(&rest_parameters); | 4581   __ bind(&rest_parameters); | 
| 4582   { | 4582   { | 
| 4583     // Compute the pointer to the first rest parameter (skippping the receiver). | 4583     // Compute the pointer to the first rest parameter (skippping the receiver). | 
| 4584     __ SmiToPtrArrayOffset(r8, r2); | 4584     __ SmiToPtrArrayOffset(r8, r2); | 
| 4585     __ AddP(r4, r4, r8); | 4585     __ AddP(r4, r4, r8); | 
| 4586     __ AddP(r4, r4, Operand(StandardFrameConstants::kCallerSPOffset)); | 4586     __ AddP(r4, r4, Operand(StandardFrameConstants::kCallerSPOffset)); | 
| 4587 | 4587 | 
| 4588     // ----------- S t a t e ------------- | 4588     // ----------- S t a t e ------------- | 
| 4589     //  -- cp : context | 4589     //  -- cp : context | 
| 4590     //  -- r2 : number of rest parameters (tagged) | 4590     //  -- r2 : number of rest parameters (tagged) | 
|  | 4591     //  -- r3 : function | 
| 4591     //  -- r4 : pointer just past first rest parameters | 4592     //  -- r4 : pointer just past first rest parameters | 
| 4592     //  -- r8 : size of rest parameters | 4593     //  -- r8 : size of rest parameters | 
| 4593     //  -- lr : return address | 4594     //  -- lr : return address | 
| 4594     // ----------------------------------- | 4595     // ----------------------------------- | 
| 4595 | 4596 | 
| 4596     // Allocate space for the rest parameter array plus the backing store. | 4597     // Allocate space for the rest parameter array plus the backing store. | 
| 4597     Label allocate, done_allocate; | 4598     Label allocate, done_allocate; | 
| 4598     __ mov(r3, Operand(JSArray::kSize + FixedArray::kHeaderSize)); | 4599     __ mov(r9, Operand(JSArray::kSize + FixedArray::kHeaderSize)); | 
| 4599     __ AddP(r3, r3, r8); | 4600     __ AddP(r9, r9, r8); | 
| 4600     __ Allocate(r3, r5, r6, r7, &allocate, NO_ALLOCATION_FLAGS); | 4601     __ Allocate(r9, r5, r6, r7, &allocate, NO_ALLOCATION_FLAGS); | 
| 4601     __ bind(&done_allocate); | 4602     __ bind(&done_allocate); | 
| 4602 | 4603 | 
| 4603     // Setup the elements array in r5. | 4604     // Setup the elements array in r5. | 
| 4604     __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); | 4605     __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); | 
| 4605     __ StoreP(r3, FieldMemOperand(r5, FixedArray::kMapOffset), r0); | 4606     __ StoreP(r3, FieldMemOperand(r5, FixedArray::kMapOffset), r0); | 
| 4606     __ StoreP(r2, FieldMemOperand(r5, FixedArray::kLengthOffset), r0); | 4607     __ StoreP(r2, FieldMemOperand(r5, FixedArray::kLengthOffset), r0); | 
| 4607     __ AddP(r6, r5, | 4608     __ AddP(r6, r5, | 
| 4608             Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize)); | 4609             Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize)); | 
| 4609     { | 4610     { | 
| 4610       Label loop; | 4611       Label loop; | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 4624     __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, r3); | 4625     __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, r3); | 
| 4625     __ StoreP(r3, MemOperand(r6, JSArray::kMapOffset)); | 4626     __ StoreP(r3, MemOperand(r6, JSArray::kMapOffset)); | 
| 4626     __ LoadRoot(r3, Heap::kEmptyFixedArrayRootIndex); | 4627     __ LoadRoot(r3, Heap::kEmptyFixedArrayRootIndex); | 
| 4627     __ StoreP(r3, MemOperand(r6, JSArray::kPropertiesOffset)); | 4628     __ StoreP(r3, MemOperand(r6, JSArray::kPropertiesOffset)); | 
| 4628     __ StoreP(r5, MemOperand(r6, JSArray::kElementsOffset)); | 4629     __ StoreP(r5, MemOperand(r6, JSArray::kElementsOffset)); | 
| 4629     __ StoreP(r2, MemOperand(r6, JSArray::kLengthOffset)); | 4630     __ StoreP(r2, MemOperand(r6, JSArray::kLengthOffset)); | 
| 4630     STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize); | 4631     STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize); | 
| 4631     __ AddP(r2, r6, Operand(kHeapObjectTag)); | 4632     __ AddP(r2, r6, Operand(kHeapObjectTag)); | 
| 4632     __ Ret(); | 4633     __ Ret(); | 
| 4633 | 4634 | 
| 4634     // Fall back to %AllocateInNewSpace. | 4635     // Fall back to %AllocateInNewSpace (if not too big). | 
|  | 4636     Label too_big_for_new_space; | 
| 4635     __ bind(&allocate); | 4637     __ bind(&allocate); | 
|  | 4638     __ CmpP(r9, Operand(Page::kMaxRegularHeapObjectSize)); | 
|  | 4639     __ bgt(&too_big_for_new_space); | 
| 4636     { | 4640     { | 
| 4637       FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 4641       FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 
| 4638       __ SmiTag(r3); | 4642       __ SmiTag(r9); | 
| 4639       __ Push(r2, r4, r3); | 4643       __ Push(r2, r4, r9); | 
| 4640       __ CallRuntime(Runtime::kAllocateInNewSpace); | 4644       __ CallRuntime(Runtime::kAllocateInNewSpace); | 
| 4641       __ LoadRR(r5, r2); | 4645       __ LoadRR(r5, r2); | 
| 4642       __ Pop(r2, r4); | 4646       __ Pop(r2, r4); | 
| 4643     } | 4647     } | 
| 4644     __ b(&done_allocate); | 4648     __ b(&done_allocate); | 
|  | 4649 | 
|  | 4650     // Fall back to %NewRestParameter. | 
|  | 4651     __ bind(&too_big_for_new_space); | 
|  | 4652     __ push(r3); | 
|  | 4653     __ TailCallRuntime(Runtime::kNewRestParameter); | 
| 4645   } | 4654   } | 
| 4646 } | 4655 } | 
| 4647 | 4656 | 
| 4648 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { | 4657 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { | 
| 4649   // ----------- S t a t e ------------- | 4658   // ----------- S t a t e ------------- | 
| 4650   //  -- r3 : function | 4659   //  -- r3 : function | 
| 4651   //  -- cp : context | 4660   //  -- cp : context | 
| 4652   //  -- fp : frame pointer | 4661   //  -- fp : frame pointer | 
| 4653   //  -- lr : return address | 4662   //  -- lr : return address | 
| 4654   // ----------------------------------- | 4663   // ----------------------------------- | 
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4924     __ bind(&ok); | 4933     __ bind(&ok); | 
| 4925   } | 4934   } | 
| 4926 | 4935 | 
| 4927   // Check if we have an arguments adaptor frame below the function frame. | 4936   // Check if we have an arguments adaptor frame below the function frame. | 
| 4928   Label arguments_adaptor, arguments_done; | 4937   Label arguments_adaptor, arguments_done; | 
| 4929   __ LoadP(r5, MemOperand(r4, StandardFrameConstants::kCallerFPOffset)); | 4938   __ LoadP(r5, MemOperand(r4, StandardFrameConstants::kCallerFPOffset)); | 
| 4930   __ LoadP(ip, MemOperand(r5, CommonFrameConstants::kContextOrFrameTypeOffset)); | 4939   __ LoadP(ip, MemOperand(r5, CommonFrameConstants::kContextOrFrameTypeOffset)); | 
| 4931   __ CmpSmiLiteral(ip, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); | 4940   __ CmpSmiLiteral(ip, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); | 
| 4932   __ beq(&arguments_adaptor); | 4941   __ beq(&arguments_adaptor); | 
| 4933   { | 4942   { | 
| 4934     __ LoadP(r3, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset)); | 4943     __ LoadP(r6, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset)); | 
| 4935     __ LoadW(r2, FieldMemOperand( | 4944     __ LoadW(r2, FieldMemOperand( | 
| 4936                      r3, SharedFunctionInfo::kFormalParameterCountOffset)); | 4945                      r6, SharedFunctionInfo::kFormalParameterCountOffset)); | 
| 4937 #if V8_TARGET_ARCH_S390X | 4946 #if V8_TARGET_ARCH_S390X | 
| 4938     __ SmiTag(r2); | 4947     __ SmiTag(r2); | 
| 4939 #endif | 4948 #endif | 
| 4940     __ SmiToPtrArrayOffset(r8, r2); | 4949     __ SmiToPtrArrayOffset(r8, r2); | 
| 4941     __ AddP(r4, r4, r8); | 4950     __ AddP(r4, r4, r8); | 
| 4942   } | 4951   } | 
| 4943   __ b(&arguments_done); | 4952   __ b(&arguments_done); | 
| 4944   __ bind(&arguments_adaptor); | 4953   __ bind(&arguments_adaptor); | 
| 4945   { | 4954   { | 
| 4946     __ LoadP(r2, MemOperand(r5, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 4955     __ LoadP(r2, MemOperand(r5, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 
| 4947     __ SmiToPtrArrayOffset(r8, r2); | 4956     __ SmiToPtrArrayOffset(r8, r2); | 
| 4948     __ AddP(r4, r5, r8); | 4957     __ AddP(r4, r5, r8); | 
| 4949   } | 4958   } | 
| 4950   __ bind(&arguments_done); | 4959   __ bind(&arguments_done); | 
| 4951   __ AddP(r4, r4, Operand(StandardFrameConstants::kCallerSPOffset)); | 4960   __ AddP(r4, r4, Operand(StandardFrameConstants::kCallerSPOffset)); | 
| 4952 | 4961 | 
| 4953   // ----------- S t a t e ------------- | 4962   // ----------- S t a t e ------------- | 
| 4954   //  -- cp : context | 4963   //  -- cp : context | 
| 4955   //  -- r2 : number of rest parameters (tagged) | 4964   //  -- r2 : number of rest parameters (tagged) | 
|  | 4965   //  -- r3 : function | 
| 4956   //  -- r4 : pointer just past first rest parameters | 4966   //  -- r4 : pointer just past first rest parameters | 
| 4957   //  -- r8 : size of rest parameters | 4967   //  -- r8 : size of rest parameters | 
| 4958   //  -- lr : return address | 4968   //  -- lr : return address | 
| 4959   // ----------------------------------- | 4969   // ----------------------------------- | 
| 4960 | 4970 | 
| 4961   // Allocate space for the strict arguments object plus the backing store. | 4971   // Allocate space for the strict arguments object plus the backing store. | 
| 4962   Label allocate, done_allocate; | 4972   Label allocate, done_allocate; | 
| 4963   __ mov(r3, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize)); | 4973   __ mov(r9, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize)); | 
| 4964   __ AddP(r3, r3, r8); | 4974   __ AddP(r9, r9, r8); | 
| 4965   __ Allocate(r3, r5, r6, r7, &allocate, NO_ALLOCATION_FLAGS); | 4975   __ Allocate(r9, r5, r6, r7, &allocate, NO_ALLOCATION_FLAGS); | 
| 4966   __ bind(&done_allocate); | 4976   __ bind(&done_allocate); | 
| 4967 | 4977 | 
| 4968   // Setup the elements array in r5. | 4978   // Setup the elements array in r5. | 
| 4969   __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); | 4979   __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); | 
| 4970   __ StoreP(r3, FieldMemOperand(r5, FixedArray::kMapOffset), r0); | 4980   __ StoreP(r3, FieldMemOperand(r5, FixedArray::kMapOffset), r0); | 
| 4971   __ StoreP(r2, FieldMemOperand(r5, FixedArray::kLengthOffset), r0); | 4981   __ StoreP(r2, FieldMemOperand(r5, FixedArray::kLengthOffset), r0); | 
| 4972   __ AddP(r6, r5, | 4982   __ AddP(r6, r5, | 
| 4973           Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize)); | 4983           Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize)); | 
| 4974   { | 4984   { | 
| 4975     Label loop, done_loop; | 4985     Label loop, done_loop; | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 4990   __ LoadNativeContextSlot(Context::STRICT_ARGUMENTS_MAP_INDEX, r3); | 5000   __ LoadNativeContextSlot(Context::STRICT_ARGUMENTS_MAP_INDEX, r3); | 
| 4991   __ StoreP(r3, MemOperand(r6, JSStrictArgumentsObject::kMapOffset)); | 5001   __ StoreP(r3, MemOperand(r6, JSStrictArgumentsObject::kMapOffset)); | 
| 4992   __ LoadRoot(r3, Heap::kEmptyFixedArrayRootIndex); | 5002   __ LoadRoot(r3, Heap::kEmptyFixedArrayRootIndex); | 
| 4993   __ StoreP(r3, MemOperand(r6, JSStrictArgumentsObject::kPropertiesOffset)); | 5003   __ StoreP(r3, MemOperand(r6, JSStrictArgumentsObject::kPropertiesOffset)); | 
| 4994   __ StoreP(r5, MemOperand(r6, JSStrictArgumentsObject::kElementsOffset)); | 5004   __ StoreP(r5, MemOperand(r6, JSStrictArgumentsObject::kElementsOffset)); | 
| 4995   __ StoreP(r2, MemOperand(r6, JSStrictArgumentsObject::kLengthOffset)); | 5005   __ StoreP(r2, MemOperand(r6, JSStrictArgumentsObject::kLengthOffset)); | 
| 4996   STATIC_ASSERT(JSStrictArgumentsObject::kSize == 4 * kPointerSize); | 5006   STATIC_ASSERT(JSStrictArgumentsObject::kSize == 4 * kPointerSize); | 
| 4997   __ AddP(r2, r6, Operand(kHeapObjectTag)); | 5007   __ AddP(r2, r6, Operand(kHeapObjectTag)); | 
| 4998   __ Ret(); | 5008   __ Ret(); | 
| 4999 | 5009 | 
| 5000   // Fall back to %AllocateInNewSpace. | 5010   // Fall back to %AllocateInNewSpace (if not too big). | 
|  | 5011   Label too_big_for_new_space; | 
| 5001   __ bind(&allocate); | 5012   __ bind(&allocate); | 
|  | 5013   __ CmpP(r9, Operand(Page::kMaxRegularHeapObjectSize)); | 
|  | 5014   __ bgt(&too_big_for_new_space); | 
| 5002   { | 5015   { | 
| 5003     FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 5016     FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 
| 5004     __ SmiTag(r3); | 5017     __ SmiTag(r9); | 
| 5005     __ Push(r2, r4, r3); | 5018     __ Push(r2, r4, r9); | 
| 5006     __ CallRuntime(Runtime::kAllocateInNewSpace); | 5019     __ CallRuntime(Runtime::kAllocateInNewSpace); | 
| 5007     __ LoadRR(r5, r2); | 5020     __ LoadRR(r5, r2); | 
| 5008     __ Pop(r2, r4); | 5021     __ Pop(r2, r4); | 
| 5009   } | 5022   } | 
| 5010   __ b(&done_allocate); | 5023   __ b(&done_allocate); | 
|  | 5024 | 
|  | 5025   // Fall back to %NewStrictArguments. | 
|  | 5026   __ bind(&too_big_for_new_space); | 
|  | 5027   __ push(r3); | 
|  | 5028   __ TailCallRuntime(Runtime::kNewStrictArguments); | 
| 5011 } | 5029 } | 
| 5012 | 5030 | 
| 5013 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) { | 5031 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) { | 
| 5014   Register context = cp; | 5032   Register context = cp; | 
| 5015   Register result = r2; | 5033   Register result = r2; | 
| 5016   Register slot = r4; | 5034   Register slot = r4; | 
| 5017 | 5035 | 
| 5018   // Go up the context chain to the script context. | 5036   // Go up the context chain to the script context. | 
| 5019   for (int i = 0; i < depth(); ++i) { | 5037   for (int i = 0; i < depth(); ++i) { | 
| 5020     __ LoadP(result, ContextMemOperand(context, Context::PREVIOUS_INDEX)); | 5038     __ LoadP(result, ContextMemOperand(context, Context::PREVIOUS_INDEX)); | 
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5513   CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5531   CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 
| 5514                            kStackUnwindSpace, NULL, return_value_operand, NULL); | 5532                            kStackUnwindSpace, NULL, return_value_operand, NULL); | 
| 5515 } | 5533 } | 
| 5516 | 5534 | 
| 5517 #undef __ | 5535 #undef __ | 
| 5518 | 5536 | 
| 5519 }  // namespace internal | 5537 }  // namespace internal | 
| 5520 }  // namespace v8 | 5538 }  // namespace v8 | 
| 5521 | 5539 | 
| 5522 #endif  // V8_TARGET_ARCH_S390 | 5540 #endif  // V8_TARGET_ARCH_S390 | 
| OLD | NEW | 
|---|