Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1316)

Unified Diff: src/arm64/code-stubs-arm64.cc

Issue 1255133002: [stubs] Properly handle read-only properties in StoreGlobalViaContextStub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, &not_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(&not_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));
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698