| 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 4480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4491 __ Pop(r2, r4); | 4491 __ Pop(r2, r4); |
| 4492 } | 4492 } |
| 4493 __ b(&done_allocate); | 4493 __ b(&done_allocate); |
| 4494 | 4494 |
| 4495 // Fall back to %NewStrictArguments. | 4495 // Fall back to %NewStrictArguments. |
| 4496 __ bind(&too_big_for_new_space); | 4496 __ bind(&too_big_for_new_space); |
| 4497 __ push(r3); | 4497 __ push(r3); |
| 4498 __ TailCallRuntime(Runtime::kNewStrictArguments); | 4498 __ TailCallRuntime(Runtime::kNewStrictArguments); |
| 4499 } | 4499 } |
| 4500 | 4500 |
| 4501 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { | |
| 4502 Register value = r2; | |
| 4503 Register slot = r4; | |
| 4504 | |
| 4505 Register cell = r3; | |
| 4506 Register cell_details = r5; | |
| 4507 Register cell_value = r6; | |
| 4508 Register cell_value_map = r7; | |
| 4509 Register scratch = r8; | |
| 4510 | |
| 4511 Register context = cp; | |
| 4512 Register context_temp = cell; | |
| 4513 | |
| 4514 Label fast_heapobject_case, fast_smi_case, slow_case; | |
| 4515 | |
| 4516 if (FLAG_debug_code) { | |
| 4517 __ CompareRoot(value, Heap::kTheHoleValueRootIndex); | |
| 4518 __ Check(ne, kUnexpectedValue); | |
| 4519 } | |
| 4520 | |
| 4521 // Go up the context chain to the script context. | |
| 4522 for (int i = 0; i < depth(); i++) { | |
| 4523 __ LoadP(context_temp, ContextMemOperand(context, Context::PREVIOUS_INDEX)); | |
| 4524 context = context_temp; | |
| 4525 } | |
| 4526 | |
| 4527 // Load the PropertyCell at the specified slot. | |
| 4528 __ ShiftLeftP(r0, slot, Operand(kPointerSizeLog2)); | |
| 4529 __ AddP(cell, context, r0); | |
| 4530 __ LoadP(cell, ContextMemOperand(cell)); | |
| 4531 | |
| 4532 // Load PropertyDetails for the cell (actually only the cell_type and kind). | |
| 4533 __ LoadP(cell_details, FieldMemOperand(cell, PropertyCell::kDetailsOffset)); | |
| 4534 __ SmiUntag(cell_details); | |
| 4535 __ AndP(cell_details, cell_details, | |
| 4536 Operand(PropertyDetails::PropertyCellTypeField::kMask | | |
| 4537 PropertyDetails::KindField::kMask | | |
| 4538 PropertyDetails::kAttributesReadOnlyMask)); | |
| 4539 | |
| 4540 // Check if PropertyCell holds mutable data. | |
| 4541 Label not_mutable_data; | |
| 4542 __ CmpP(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode( | |
| 4543 PropertyCellType::kMutable) | | |
| 4544 PropertyDetails::KindField::encode(kData))); | |
| 4545 __ bne(¬_mutable_data); | |
| 4546 __ JumpIfSmi(value, &fast_smi_case); | |
| 4547 | |
| 4548 __ bind(&fast_heapobject_case); | |
| 4549 __ StoreP(value, FieldMemOperand(cell, PropertyCell::kValueOffset), r0); | |
| 4550 // RecordWriteField clobbers the value register, so we copy it before the | |
| 4551 // call. | |
| 4552 __ LoadRR(r5, value); | |
| 4553 __ RecordWriteField(cell, PropertyCell::kValueOffset, r5, scratch, | |
| 4554 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, | |
| 4555 OMIT_SMI_CHECK); | |
| 4556 __ Ret(); | |
| 4557 | |
| 4558 __ bind(¬_mutable_data); | |
| 4559 // Check if PropertyCell value matches the new value (relevant for Constant, | |
| 4560 // ConstantType and Undefined cells). | |
| 4561 Label not_same_value; | |
| 4562 __ LoadP(cell_value, FieldMemOperand(cell, PropertyCell::kValueOffset)); | |
| 4563 __ CmpP(cell_value, value); | |
| 4564 __ bne(¬_same_value); | |
| 4565 | |
| 4566 // Make sure the PropertyCell is not marked READ_ONLY. | |
| 4567 __ AndP(r0, cell_details, Operand(PropertyDetails::kAttributesReadOnlyMask)); | |
| 4568 __ bne(&slow_case); | |
| 4569 | |
| 4570 if (FLAG_debug_code) { | |
| 4571 Label done; | |
| 4572 // This can only be true for Constant, ConstantType and Undefined cells, | |
| 4573 // because we never store the_hole via this stub. | |
| 4574 __ CmpP(cell_details, | |
| 4575 Operand(PropertyDetails::PropertyCellTypeField::encode( | |
| 4576 PropertyCellType::kConstant) | | |
| 4577 PropertyDetails::KindField::encode(kData))); | |
| 4578 __ beq(&done); | |
| 4579 __ CmpP(cell_details, | |
| 4580 Operand(PropertyDetails::PropertyCellTypeField::encode( | |
| 4581 PropertyCellType::kConstantType) | | |
| 4582 PropertyDetails::KindField::encode(kData))); | |
| 4583 __ beq(&done); | |
| 4584 __ CmpP(cell_details, | |
| 4585 Operand(PropertyDetails::PropertyCellTypeField::encode( | |
| 4586 PropertyCellType::kUndefined) | | |
| 4587 PropertyDetails::KindField::encode(kData))); | |
| 4588 __ Check(eq, kUnexpectedValue); | |
| 4589 __ bind(&done); | |
| 4590 } | |
| 4591 __ Ret(); | |
| 4592 __ bind(¬_same_value); | |
| 4593 | |
| 4594 // Check if PropertyCell contains data with constant type (and is not | |
| 4595 // READ_ONLY). | |
| 4596 __ CmpP(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode( | |
| 4597 PropertyCellType::kConstantType) | | |
| 4598 PropertyDetails::KindField::encode(kData))); | |
| 4599 __ bne(&slow_case); | |
| 4600 | |
| 4601 // Now either both old and new values must be smis or both must be heap | |
| 4602 // objects with same map. | |
| 4603 Label value_is_heap_object; | |
| 4604 __ JumpIfNotSmi(value, &value_is_heap_object); | |
| 4605 __ JumpIfNotSmi(cell_value, &slow_case); | |
| 4606 // Old and new values are smis, no need for a write barrier here. | |
| 4607 __ bind(&fast_smi_case); | |
| 4608 __ StoreP(value, FieldMemOperand(cell, PropertyCell::kValueOffset), r0); | |
| 4609 __ Ret(); | |
| 4610 | |
| 4611 __ bind(&value_is_heap_object); | |
| 4612 __ JumpIfSmi(cell_value, &slow_case); | |
| 4613 | |
| 4614 __ LoadP(cell_value_map, FieldMemOperand(cell_value, HeapObject::kMapOffset)); | |
| 4615 __ LoadP(scratch, FieldMemOperand(value, HeapObject::kMapOffset)); | |
| 4616 __ CmpP(cell_value_map, scratch); | |
| 4617 __ beq(&fast_heapobject_case); | |
| 4618 | |
| 4619 // Fallback to runtime. | |
| 4620 __ bind(&slow_case); | |
| 4621 __ SmiTag(slot); | |
| 4622 __ Push(slot, value); | |
| 4623 __ TailCallRuntime(is_strict(language_mode()) | |
| 4624 ? Runtime::kStoreGlobalViaContext_Strict | |
| 4625 : Runtime::kStoreGlobalViaContext_Sloppy); | |
| 4626 } | |
| 4627 | |
| 4628 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { | 4501 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { |
| 4629 return ref0.address() - ref1.address(); | 4502 return ref0.address() - ref1.address(); |
| 4630 } | 4503 } |
| 4631 | 4504 |
| 4632 // Calls an API function. Allocates HandleScope, extracts returned value | 4505 // Calls an API function. Allocates HandleScope, extracts returned value |
| 4633 // from handle and propagates exceptions. Restores context. stack_space | 4506 // from handle and propagates exceptions. Restores context. stack_space |
| 4634 // - space to be unwound on exit (includes the call JS arguments space and | 4507 // - space to be unwound on exit (includes the call JS arguments space and |
| 4635 // the additional space allocated for the fast call). | 4508 // the additional space allocated for the fast call). |
| 4636 static void CallApiFunctionAndReturn(MacroAssembler* masm, | 4509 static void CallApiFunctionAndReturn(MacroAssembler* masm, |
| 4637 Register function_address, | 4510 Register function_address, |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4971 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 4844 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
| 4972 kStackUnwindSpace, NULL, return_value_operand, NULL); | 4845 kStackUnwindSpace, NULL, return_value_operand, NULL); |
| 4973 } | 4846 } |
| 4974 | 4847 |
| 4975 #undef __ | 4848 #undef __ |
| 4976 | 4849 |
| 4977 } // namespace internal | 4850 } // namespace internal |
| 4978 } // namespace v8 | 4851 } // namespace v8 |
| 4979 | 4852 |
| 4980 #endif // V8_TARGET_ARCH_S390 | 4853 #endif // V8_TARGET_ARCH_S390 |
| OLD | NEW |