| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 5102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5113 // Go up the context chain to the script context. | 5113 // Go up the context chain to the script context. |
| 5114 for (int i = 0; i < depth(); i++) { | 5114 for (int i = 0; i < depth(); i++) { |
| 5115 __ ldr(context_temp, ContextOperand(context, Context::PREVIOUS_INDEX)); | 5115 __ ldr(context_temp, ContextOperand(context, Context::PREVIOUS_INDEX)); |
| 5116 context = context_temp; | 5116 context = context_temp; |
| 5117 } | 5117 } |
| 5118 | 5118 |
| 5119 // Load the PropertyCell at the specified slot. | 5119 // Load the PropertyCell at the specified slot. |
| 5120 __ add(cell, context, Operand(slot, LSL, kPointerSizeLog2)); | 5120 __ add(cell, context, Operand(slot, LSL, kPointerSizeLog2)); |
| 5121 __ ldr(cell, ContextOperand(cell)); | 5121 __ ldr(cell, ContextOperand(cell)); |
| 5122 | 5122 |
| 5123 // Check that cell value is not the_hole. | |
| 5124 __ ldr(cell_value, FieldMemOperand(cell, PropertyCell::kValueOffset)); | |
| 5125 __ CompareRoot(cell_value, Heap::kTheHoleValueRootIndex); | |
| 5126 __ b(eq, &slow_case); | |
| 5127 | |
| 5128 // Load PropertyDetails for the cell (actually only the cell_type and kind). | 5123 // Load PropertyDetails for the cell (actually only the cell_type and kind). |
| 5129 __ ldr(cell_details, FieldMemOperand(cell, PropertyCell::kDetailsOffset)); | 5124 __ ldr(cell_details, FieldMemOperand(cell, PropertyCell::kDetailsOffset)); |
| 5130 __ SmiUntag(cell_details); | 5125 __ SmiUntag(cell_details); |
| 5131 __ and_(cell_details, cell_details, | 5126 __ and_(cell_details, cell_details, |
| 5132 Operand(PropertyDetails::PropertyCellTypeField::kMask | | 5127 Operand(PropertyDetails::PropertyCellTypeField::kMask | |
| 5133 PropertyDetails::KindField::kMask)); | 5128 PropertyDetails::KindField::kMask | |
| 5129 PropertyDetails::kAttributesReadOnlyMask)); |
| 5134 | 5130 |
| 5135 // Check if PropertyCell holds mutable data. | 5131 // Check if PropertyCell holds mutable data. |
| 5136 Label not_mutable_data; | 5132 Label not_mutable_data; |
| 5137 __ cmp(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode( | 5133 __ cmp(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode( |
| 5138 PropertyCellType::kMutable) | | 5134 PropertyCellType::kMutable) | |
| 5139 PropertyDetails::KindField::encode(kData))); | 5135 PropertyDetails::KindField::encode(kData))); |
| 5140 __ b(ne, ¬_mutable_data); | 5136 __ b(ne, ¬_mutable_data); |
| 5141 __ JumpIfSmi(value, &fast_smi_case); | 5137 __ JumpIfSmi(value, &fast_smi_case); |
| 5142 | 5138 |
| 5143 __ bind(&fast_heapobject_case); | 5139 __ bind(&fast_heapobject_case); |
| 5144 __ str(value, FieldMemOperand(cell, PropertyCell::kValueOffset)); | 5140 __ str(value, FieldMemOperand(cell, PropertyCell::kValueOffset)); |
| 5145 // RecordWriteField clobbers the value register, so we copy it before the | 5141 // RecordWriteField clobbers the value register, so we copy it before the |
| 5146 // call. | 5142 // call. |
| 5147 __ mov(r4, Operand(value)); | 5143 __ mov(r4, Operand(value)); |
| 5148 __ RecordWriteField(cell, PropertyCell::kValueOffset, r4, scratch, | 5144 __ RecordWriteField(cell, PropertyCell::kValueOffset, r4, scratch, |
| 5149 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, | 5145 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, |
| 5150 OMIT_SMI_CHECK); | 5146 OMIT_SMI_CHECK); |
| 5151 __ Ret(); | 5147 __ Ret(); |
| 5152 | 5148 |
| 5153 __ bind(¬_mutable_data); | 5149 __ bind(¬_mutable_data); |
| 5154 // Check if PropertyCell value matches the new value (relevant for Constant, | 5150 // Check if PropertyCell value matches the new value (relevant for Constant, |
| 5155 // ConstantType and Undefined cells). | 5151 // ConstantType and Undefined cells). |
| 5156 Label not_same_value; | 5152 Label not_same_value; |
| 5153 __ ldr(cell_value, FieldMemOperand(cell, PropertyCell::kValueOffset)); |
| 5157 __ cmp(cell_value, value); | 5154 __ cmp(cell_value, value); |
| 5158 __ b(ne, ¬_same_value); | 5155 __ b(ne, ¬_same_value); |
| 5159 | 5156 |
| 5157 // Make sure the PropertyCell is not marked READ_ONLY. |
| 5158 __ tst(cell_details, Operand(PropertyDetails::kAttributesReadOnlyMask)); |
| 5159 __ b(ne, &slow_case); |
| 5160 |
| 5160 if (FLAG_debug_code) { | 5161 if (FLAG_debug_code) { |
| 5161 Label done; | 5162 Label done; |
| 5162 // This can only be true for Constant, ConstantType and Undefined cells, | 5163 // This can only be true for Constant, ConstantType and Undefined cells, |
| 5163 // because we never store the_hole via this stub. | 5164 // because we never store the_hole via this stub. |
| 5164 __ cmp(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode( | 5165 __ cmp(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode( |
| 5165 PropertyCellType::kConstant) | | 5166 PropertyCellType::kConstant) | |
| 5166 PropertyDetails::KindField::encode(kData))); | 5167 PropertyDetails::KindField::encode(kData))); |
| 5167 __ b(eq, &done); | 5168 __ b(eq, &done); |
| 5168 __ cmp(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode( | 5169 __ cmp(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode( |
| 5169 PropertyCellType::kConstantType) | | 5170 PropertyCellType::kConstantType) | |
| 5170 PropertyDetails::KindField::encode(kData))); | 5171 PropertyDetails::KindField::encode(kData))); |
| 5171 __ b(eq, &done); | 5172 __ b(eq, &done); |
| 5172 __ cmp(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode( | 5173 __ cmp(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode( |
| 5173 PropertyCellType::kUndefined) | | 5174 PropertyCellType::kUndefined) | |
| 5174 PropertyDetails::KindField::encode(kData))); | 5175 PropertyDetails::KindField::encode(kData))); |
| 5175 __ Check(eq, kUnexpectedValue); | 5176 __ Check(eq, kUnexpectedValue); |
| 5176 __ bind(&done); | 5177 __ bind(&done); |
| 5177 } | 5178 } |
| 5178 __ Ret(); | 5179 __ Ret(); |
| 5179 __ bind(¬_same_value); | 5180 __ bind(¬_same_value); |
| 5180 | 5181 |
| 5181 // Check if PropertyCell contains data with constant type. | 5182 // Check if PropertyCell contains data with constant type (and is not |
| 5183 // READ_ONLY). |
| 5182 __ cmp(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode( | 5184 __ cmp(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode( |
| 5183 PropertyCellType::kConstantType) | | 5185 PropertyCellType::kConstantType) | |
| 5184 PropertyDetails::KindField::encode(kData))); | 5186 PropertyDetails::KindField::encode(kData))); |
| 5185 __ b(ne, &slow_case); | 5187 __ b(ne, &slow_case); |
| 5186 | 5188 |
| 5187 // Now either both old and new values must be smis or both must be heap | 5189 // Now either both old and new values must be smis or both must be heap |
| 5188 // objects with same map. | 5190 // objects with same map. |
| 5189 Label value_is_heap_object; | 5191 Label value_is_heap_object; |
| 5190 __ JumpIfNotSmi(value, &value_is_heap_object); | 5192 __ JumpIfNotSmi(value, &value_is_heap_object); |
| 5191 __ JumpIfNotSmi(cell_value, &slow_case); | 5193 __ JumpIfNotSmi(cell_value, &slow_case); |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5530 MemOperand(fp, 6 * kPointerSize), NULL); | 5532 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5531 } | 5533 } |
| 5532 | 5534 |
| 5533 | 5535 |
| 5534 #undef __ | 5536 #undef __ |
| 5535 | 5537 |
| 5536 } // namespace internal | 5538 } // namespace internal |
| 5537 } // namespace v8 | 5539 } // namespace v8 |
| 5538 | 5540 |
| 5539 #endif // V8_TARGET_ARCH_ARM | 5541 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |