Index: src/mips/code-stubs-mips.cc |
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc |
index ae4f3de578723a289349214fe9d356c5f8400110..cb6d67f3b551fe4c58250c2158e89c934fec1a41 100644 |
--- a/src/mips/code-stubs-mips.cc |
+++ b/src/mips/code-stubs-mips.cc |
@@ -5331,18 +5331,14 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { |
__ Addu(at, at, Context::SlotOffset(0)); |
__ lw(cell_reg, MemOperand(at)); |
- // Check that cell value is not the_hole. |
- __ lw(cell_value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); |
- __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
- __ Branch(&slow_case, eq, cell_value_reg, Operand(at)); |
- |
// Load PropertyDetails for the cell (actually only the cell_type and kind). |
__ lw(cell_details_reg, |
FieldMemOperand(cell_reg, PropertyCell::kDetailsOffset)); |
__ SmiUntag(cell_details_reg); |
__ And(cell_details_reg, cell_details_reg, |
PropertyDetails::PropertyCellTypeField::kMask | |
- PropertyDetails::KindField::kMask); |
+ PropertyDetails::KindField::kMask | |
+ PropertyDetails::kAttributesReadOnlyMask); |
// Check if PropertyCell holds mutable data. |
Label not_mutable_data; |
@@ -5364,7 +5360,11 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { |
// Check if PropertyCell value matches the new value (relevant for Constant, |
// ConstantType and Undefined cells). |
Label not_same_value; |
+ __ lw(cell_value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); |
__ Branch(¬_same_value, ne, value_reg, Operand(cell_value_reg)); |
+ // Make sure the PropertyCell is not marked READ_ONLY. |
+ __ And(at, cell_details_reg, PropertyDetails::kAttributesReadOnlyMask); |
+ __ Branch(&slow_case, ne, at, Operand(zero_reg)); |
if (FLAG_debug_code) { |
Label done; |
// This can only be true for Constant, ConstantType and Undefined cells, |
@@ -5386,7 +5386,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). |
__ Branch(&slow_case, ne, cell_details_reg, |
Operand(PropertyDetails::PropertyCellTypeField::encode( |
PropertyCellType::kConstantType) | |