PPC: [stubs] Properly handle read-only properties in StoreGlobalViaContextStub.
authormbrandy <mbrandy@us.ibm.com>
Mon, 27 Jul 2015 20:12:10 +0000 (13:12 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 27 Jul 2015 20:12:26 +0000 (20:12 +0000)
Port cac64b9f634743f7f5311d4dca8d50157b10fab5

Original commit message:
    We don't need the hole check and slow runtime mode for read-only
    properties this way.

R=bmeurer@chromium.org, dstence@us.ibm.com, michael_dawson@ca.ibm.com
BUG=

Review URL: https://codereview.chromium.org/1257183003

Cr-Commit-Position: refs/heads/master@{#29882}

src/ppc/code-stubs-ppc.cc

index f473b95..c2cc1e9 100644 (file)
@@ -5377,17 +5377,13 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   __ add(cell, context, r0);
   __ LoadP(cell, ContextOperand(cell));
 
-  // Check that cell value is not the_hole.
-  __ LoadP(cell_value, FieldMemOperand(cell, PropertyCell::kValueOffset));
-  __ CompareRoot(cell_value, Heap::kTheHoleValueRootIndex);
-  __ beq(&slow_case);
-
   // Load PropertyDetails for the cell (actually only the cell_type and kind).
   __ LoadP(cell_details, FieldMemOperand(cell, PropertyCell::kDetailsOffset));
   __ SmiUntag(cell_details);
   __ andi(cell_details, cell_details,
           Operand(PropertyDetails::PropertyCellTypeField::kMask |
-                  PropertyDetails::KindField::kMask));
+                  PropertyDetails::KindField::kMask |
+                  PropertyDetails::kAttributesReadOnlyMask));
 
   // Check if PropertyCell holds mutable data.
   Label not_mutable_data;
@@ -5411,9 +5407,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;
+  __ LoadP(cell_value, FieldMemOperand(cell, PropertyCell::kValueOffset));
   __ cmp(cell_value, value);
   __ bne(&not_same_value);
 
+  // Make sure the PropertyCell is not marked READ_ONLY.
+  __ andi(r0, cell_details, Operand(PropertyDetails::kAttributesReadOnlyMask));
+  __ bne(&slow_case, cr0);
+
   if (FLAG_debug_code) {
     Label done;
     // This can only be true for Constant, ConstantType and Undefined cells,
@@ -5438,7 +5439,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).
   __ cmpi(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode(
                                     PropertyCellType::kConstantType) |
                                 PropertyDetails::KindField::encode(kData)));