OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 5535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5546 // Go up the context chain to the script context. | 5546 // Go up the context chain to the script context. |
5547 for (int i = 0; i < depth(); i++) { | 5547 for (int i = 0; i < depth(); i++) { |
5548 __ Ldr(context_temp, ContextMemOperand(context, Context::PREVIOUS_INDEX)); | 5548 __ Ldr(context_temp, ContextMemOperand(context, Context::PREVIOUS_INDEX)); |
5549 context = context_temp; | 5549 context = context_temp; |
5550 } | 5550 } |
5551 | 5551 |
5552 // Load the PropertyCell at the specified slot. | 5552 // Load the PropertyCell at the specified slot. |
5553 __ Add(cell, context, Operand(slot, LSL, kPointerSizeLog2)); | 5553 __ Add(cell, context, Operand(slot, LSL, kPointerSizeLog2)); |
5554 __ Ldr(cell, ContextMemOperand(cell)); | 5554 __ Ldr(cell, ContextMemOperand(cell)); |
5555 | 5555 |
5556 // Check that cell value is not the_hole. | |
5557 __ Ldr(cell_value, FieldMemOperand(cell, PropertyCell::kValueOffset)); | |
5558 __ JumpIfRoot(cell_value, Heap::kTheHoleValueRootIndex, &slow_case); | |
5559 | |
5560 // Load PropertyDetails for the cell (actually only the cell_type and kind). | 5556 // Load PropertyDetails for the cell (actually only the cell_type and kind). |
5561 __ Ldr(cell_details, | 5557 __ Ldr(cell_details, |
5562 UntagSmiFieldMemOperand(cell, PropertyCell::kDetailsOffset)); | 5558 UntagSmiFieldMemOperand(cell, PropertyCell::kDetailsOffset)); |
5563 __ And(cell_details, cell_details, | 5559 __ And(cell_details, cell_details, |
5564 PropertyDetails::PropertyCellTypeField::kMask | | 5560 PropertyDetails::PropertyCellTypeField::kMask | |
5565 PropertyDetails::KindField::kMask); | 5561 PropertyDetails::KindField::kMask | |
| 5562 PropertyDetails::kAttributesReadOnlyMask); |
5566 | 5563 |
5567 // Check if PropertyCell holds mutable data. | 5564 // Check if PropertyCell holds mutable data. |
5568 Label not_mutable_data; | 5565 Label not_mutable_data; |
5569 __ Cmp(cell_details, PropertyDetails::PropertyCellTypeField::encode( | 5566 __ Cmp(cell_details, PropertyDetails::PropertyCellTypeField::encode( |
5570 PropertyCellType::kMutable) | | 5567 PropertyCellType::kMutable) | |
5571 PropertyDetails::KindField::encode(kData)); | 5568 PropertyDetails::KindField::encode(kData)); |
5572 __ B(ne, ¬_mutable_data); | 5569 __ B(ne, ¬_mutable_data); |
5573 __ JumpIfSmi(value, &fast_smi_case); | 5570 __ JumpIfSmi(value, &fast_smi_case); |
5574 __ Bind(&fast_heapobject_case); | 5571 __ Bind(&fast_heapobject_case); |
5575 __ Str(value, FieldMemOperand(cell, PropertyCell::kValueOffset)); | 5572 __ Str(value, FieldMemOperand(cell, PropertyCell::kValueOffset)); |
5576 // RecordWriteField clobbers the value register, so we copy it before the | 5573 // RecordWriteField clobbers the value register, so we copy it before the |
5577 // call. | 5574 // call. |
5578 __ Mov(x11, value); | 5575 __ Mov(x11, value); |
5579 __ RecordWriteField(cell, PropertyCell::kValueOffset, x11, x12, | 5576 __ RecordWriteField(cell, PropertyCell::kValueOffset, x11, x12, |
5580 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, | 5577 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, |
5581 OMIT_SMI_CHECK); | 5578 OMIT_SMI_CHECK); |
5582 __ Ret(); | 5579 __ Ret(); |
5583 | 5580 |
5584 __ Bind(¬_mutable_data); | 5581 __ Bind(¬_mutable_data); |
5585 // Check if PropertyCell value matches the new value (relevant for Constant, | 5582 // Check if PropertyCell value matches the new value (relevant for Constant, |
5586 // ConstantType and Undefined cells). | 5583 // ConstantType and Undefined cells). |
5587 Label not_same_value; | 5584 Label not_same_value; |
| 5585 __ Ldr(cell_value, FieldMemOperand(cell, PropertyCell::kValueOffset)); |
5588 __ Cmp(cell_value, value); | 5586 __ Cmp(cell_value, value); |
5589 __ B(ne, ¬_same_value); | 5587 __ B(ne, ¬_same_value); |
5590 | 5588 |
| 5589 // Make sure the PropertyCell is not marked READ_ONLY. |
| 5590 __ Tst(cell_details, PropertyDetails::kAttributesReadOnlyMask); |
| 5591 __ B(ne, &slow_case); |
| 5592 |
5591 if (FLAG_debug_code) { | 5593 if (FLAG_debug_code) { |
5592 Label done; | 5594 Label done; |
5593 // This can only be true for Constant, ConstantType and Undefined cells, | 5595 // This can only be true for Constant, ConstantType and Undefined cells, |
5594 // because we never store the_hole via this stub. | 5596 // because we never store the_hole via this stub. |
5595 __ Cmp(cell_details, PropertyDetails::PropertyCellTypeField::encode( | 5597 __ Cmp(cell_details, PropertyDetails::PropertyCellTypeField::encode( |
5596 PropertyCellType::kConstant) | | 5598 PropertyCellType::kConstant) | |
5597 PropertyDetails::KindField::encode(kData)); | 5599 PropertyDetails::KindField::encode(kData)); |
5598 __ B(eq, &done); | 5600 __ B(eq, &done); |
5599 __ Cmp(cell_details, PropertyDetails::PropertyCellTypeField::encode( | 5601 __ Cmp(cell_details, PropertyDetails::PropertyCellTypeField::encode( |
5600 PropertyCellType::kConstantType) | | 5602 PropertyCellType::kConstantType) | |
5601 PropertyDetails::KindField::encode(kData)); | 5603 PropertyDetails::KindField::encode(kData)); |
5602 __ B(eq, &done); | 5604 __ B(eq, &done); |
5603 __ Cmp(cell_details, PropertyDetails::PropertyCellTypeField::encode( | 5605 __ Cmp(cell_details, PropertyDetails::PropertyCellTypeField::encode( |
5604 PropertyCellType::kUndefined) | | 5606 PropertyCellType::kUndefined) | |
5605 PropertyDetails::KindField::encode(kData)); | 5607 PropertyDetails::KindField::encode(kData)); |
5606 __ Check(eq, kUnexpectedValue); | 5608 __ Check(eq, kUnexpectedValue); |
5607 __ Bind(&done); | 5609 __ Bind(&done); |
5608 } | 5610 } |
5609 __ Ret(); | 5611 __ Ret(); |
5610 __ Bind(¬_same_value); | 5612 __ Bind(¬_same_value); |
5611 | 5613 |
5612 // Check if PropertyCell contains data with constant type. | 5614 // Check if PropertyCell contains data with constant type (and is not |
| 5615 // READ_ONLY). |
5613 __ Cmp(cell_details, PropertyDetails::PropertyCellTypeField::encode( | 5616 __ Cmp(cell_details, PropertyDetails::PropertyCellTypeField::encode( |
5614 PropertyCellType::kConstantType) | | 5617 PropertyCellType::kConstantType) | |
5615 PropertyDetails::KindField::encode(kData)); | 5618 PropertyDetails::KindField::encode(kData)); |
5616 __ B(ne, &slow_case); | 5619 __ B(ne, &slow_case); |
5617 | 5620 |
5618 // Now either both old and new values must be smis or both must be heap | 5621 // Now either both old and new values must be smis or both must be heap |
5619 // objects with same map. | 5622 // objects with same map. |
5620 Label value_is_heap_object; | 5623 Label value_is_heap_object; |
5621 __ JumpIfNotSmi(value, &value_is_heap_object); | 5624 __ JumpIfNotSmi(value, &value_is_heap_object); |
5622 __ JumpIfNotSmi(cell_value, &slow_case); | 5625 __ JumpIfNotSmi(cell_value, &slow_case); |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5987 MemOperand(fp, 6 * kPointerSize), NULL); | 5990 MemOperand(fp, 6 * kPointerSize), NULL); |
5988 } | 5991 } |
5989 | 5992 |
5990 | 5993 |
5991 #undef __ | 5994 #undef __ |
5992 | 5995 |
5993 } // namespace internal | 5996 } // namespace internal |
5994 } // namespace v8 | 5997 } // namespace v8 |
5995 | 5998 |
5996 #endif // V8_TARGET_ARCH_ARM64 | 5999 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |