Commit 02f09748 authored by chunyang.dai's avatar chunyang.dai Committed by Commit bot

X87: [stubs] Properly handle read-only properties in StoreGlobalViaContextStub.

port cac64b9f (r29881)

original commit message:

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

BUG=

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

Cr-Commit-Position: refs/heads/master@{#29891}
parent 95fc22e4
...@@ -4853,23 +4853,14 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { ...@@ -4853,23 +4853,14 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
// Load the PropertyCell at the specified slot. // Load the PropertyCell at the specified slot.
__ mov(cell_reg, ContextOperand(context_reg, slot_reg)); __ mov(cell_reg, ContextOperand(context_reg, slot_reg));
// Check that cell value is not the_hole.
{
// TODO(bmeurer): use ecx (name_reg) when name parameter is removed.
Register cell_value_reg = cell_details_reg;
__ mov(cell_value_reg, FieldOperand(cell_reg, PropertyCell::kValueOffset));
__ CompareRoot(cell_value_reg, Heap::kTheHoleValueRootIndex);
__ j(equal, &slow_case, FLAG_debug_code ? Label::kFar : Label::kNear);
}
// Load PropertyDetails for the cell (actually only the cell_type and kind). // Load PropertyDetails for the cell (actually only the cell_type and kind).
__ mov(cell_details_reg, __ mov(cell_details_reg,
FieldOperand(cell_reg, PropertyCell::kDetailsOffset)); FieldOperand(cell_reg, PropertyCell::kDetailsOffset));
__ SmiUntag(cell_details_reg); __ SmiUntag(cell_details_reg);
__ and_(cell_details_reg, __ and_(cell_details_reg,
Immediate(PropertyDetails::PropertyCellTypeField::kMask | Immediate(PropertyDetails::PropertyCellTypeField::kMask |
PropertyDetails::KindField::kMask)); PropertyDetails::KindField::kMask |
PropertyDetails::kAttributesReadOnlyMask));
// Check if PropertyCell holds mutable data. // Check if PropertyCell holds mutable data.
Label not_mutable_data; Label not_mutable_data;
...@@ -4895,6 +4886,10 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { ...@@ -4895,6 +4886,10 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
__ cmp(value_reg, FieldOperand(cell_reg, PropertyCell::kValueOffset)); __ cmp(value_reg, FieldOperand(cell_reg, PropertyCell::kValueOffset));
__ j(not_equal, &not_same_value, __ j(not_equal, &not_same_value,
FLAG_debug_code ? Label::kFar : Label::kNear); FLAG_debug_code ? Label::kFar : Label::kNear);
// Make sure the PropertyCell is not marked READ_ONLY.
__ test(cell_details_reg,
Immediate(PropertyDetails::kAttributesReadOnlyMask));
__ j(not_zero, &slow_case);
if (FLAG_debug_code) { if (FLAG_debug_code) {
Label done; Label done;
// This can only be true for Constant, ConstantType and Undefined cells, // This can only be true for Constant, ConstantType and Undefined cells,
...@@ -4919,7 +4914,8 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { ...@@ -4919,7 +4914,8 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
__ Ret(); __ Ret();
__ bind(&not_same_value); __ 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_reg, __ cmp(cell_details_reg,
Immediate(PropertyDetails::PropertyCellTypeField::encode( Immediate(PropertyDetails::PropertyCellTypeField::encode(
PropertyCellType::kConstantType) | PropertyCellType::kConstantType) |
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment