Index: src/arm64/code-stubs-arm64.cc |
diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc |
index b62d374b7bf63026e4b24a5a467738e84b1dcde3..d8b153240ba23bbbb3d8a2b1cdd5866fb21f91dd 100644 |
--- a/src/arm64/code-stubs-arm64.cc |
+++ b/src/arm64/code-stubs-arm64.cc |
@@ -5553,16 +5553,13 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { |
__ Add(cell, context, Operand(slot, LSL, kPointerSizeLog2)); |
__ Ldr(cell, ContextMemOperand(cell)); |
- // Check that cell value is not the_hole. |
- __ Ldr(cell_value, FieldMemOperand(cell, PropertyCell::kValueOffset)); |
- __ JumpIfRoot(cell_value, Heap::kTheHoleValueRootIndex, &slow_case); |
- |
// Load PropertyDetails for the cell (actually only the cell_type and kind). |
__ Ldr(cell_details, |
UntagSmiFieldMemOperand(cell, PropertyCell::kDetailsOffset)); |
__ And(cell_details, cell_details, |
PropertyDetails::PropertyCellTypeField::kMask | |
- PropertyDetails::KindField::kMask); |
+ PropertyDetails::KindField::kMask | |
+ PropertyDetails::kAttributesReadOnlyMask); |
// Check if PropertyCell holds mutable data. |
Label not_mutable_data; |
@@ -5585,9 +5582,14 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { |
// Check if PropertyCell value matches the new value (relevant for Constant, |
// ConstantType and Undefined cells). |
Label not_same_value; |
+ __ Ldr(cell_value, FieldMemOperand(cell, PropertyCell::kValueOffset)); |
__ Cmp(cell_value, value); |
__ B(ne, ¬_same_value); |
+ // Make sure the PropertyCell is not marked READ_ONLY. |
+ __ Tst(cell_details, PropertyDetails::kAttributesReadOnlyMask); |
+ __ B(ne, &slow_case); |
+ |
if (FLAG_debug_code) { |
Label done; |
// This can only be true for Constant, ConstantType and Undefined cells, |
@@ -5609,7 +5611,8 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { |
__ Ret(); |
__ Bind(¬_same_value); |
- // Check if PropertyCell contains data with constant type. |
+ // Check if PropertyCell contains data with constant type (and is not |
+ // READ_ONLY). |
__ Cmp(cell_details, PropertyDetails::PropertyCellTypeField::encode( |
PropertyCellType::kConstantType) | |
PropertyDetails::KindField::encode(kData)); |