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_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
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 5313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5324 __ lw(cell_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); | 5324 __ lw(cell_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); |
5325 context_reg = cell_reg; | 5325 context_reg = cell_reg; |
5326 } | 5326 } |
5327 | 5327 |
5328 // Load the PropertyCell at the specified slot. | 5328 // Load the PropertyCell at the specified slot. |
5329 __ sll(at, slot_reg, kPointerSizeLog2); | 5329 __ sll(at, slot_reg, kPointerSizeLog2); |
5330 __ Addu(at, at, Operand(context_reg)); | 5330 __ Addu(at, at, Operand(context_reg)); |
5331 __ Addu(at, at, Context::SlotOffset(0)); | 5331 __ Addu(at, at, Context::SlotOffset(0)); |
5332 __ lw(cell_reg, MemOperand(at)); | 5332 __ lw(cell_reg, MemOperand(at)); |
5333 | 5333 |
5334 // Check that cell value is not the_hole. | |
5335 __ lw(cell_value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); | |
5336 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | |
5337 __ Branch(&slow_case, eq, cell_value_reg, Operand(at)); | |
5338 | |
5339 // Load PropertyDetails for the cell (actually only the cell_type and kind). | 5334 // Load PropertyDetails for the cell (actually only the cell_type and kind). |
5340 __ lw(cell_details_reg, | 5335 __ lw(cell_details_reg, |
5341 FieldMemOperand(cell_reg, PropertyCell::kDetailsOffset)); | 5336 FieldMemOperand(cell_reg, PropertyCell::kDetailsOffset)); |
5342 __ SmiUntag(cell_details_reg); | 5337 __ SmiUntag(cell_details_reg); |
5343 __ And(cell_details_reg, cell_details_reg, | 5338 __ And(cell_details_reg, cell_details_reg, |
5344 PropertyDetails::PropertyCellTypeField::kMask | | 5339 PropertyDetails::PropertyCellTypeField::kMask | |
5345 PropertyDetails::KindField::kMask); | 5340 PropertyDetails::KindField::kMask | |
| 5341 PropertyDetails::kAttributesReadOnlyMask); |
5346 | 5342 |
5347 // Check if PropertyCell holds mutable data. | 5343 // Check if PropertyCell holds mutable data. |
5348 Label not_mutable_data; | 5344 Label not_mutable_data; |
5349 __ Branch(¬_mutable_data, ne, cell_details_reg, | 5345 __ Branch(¬_mutable_data, ne, cell_details_reg, |
5350 Operand(PropertyDetails::PropertyCellTypeField::encode( | 5346 Operand(PropertyDetails::PropertyCellTypeField::encode( |
5351 PropertyCellType::kMutable) | | 5347 PropertyCellType::kMutable) | |
5352 PropertyDetails::KindField::encode(kData))); | 5348 PropertyDetails::KindField::encode(kData))); |
5353 __ JumpIfSmi(value_reg, &fast_smi_case); | 5349 __ JumpIfSmi(value_reg, &fast_smi_case); |
5354 __ bind(&fast_heapobject_case); | 5350 __ bind(&fast_heapobject_case); |
5355 __ sw(value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); | 5351 __ sw(value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); |
5356 __ RecordWriteField(cell_reg, PropertyCell::kValueOffset, value_reg, | 5352 __ RecordWriteField(cell_reg, PropertyCell::kValueOffset, value_reg, |
5357 cell_details_reg, kRAHasNotBeenSaved, kDontSaveFPRegs, | 5353 cell_details_reg, kRAHasNotBeenSaved, kDontSaveFPRegs, |
5358 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | 5354 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
5359 // RecordWriteField clobbers the value register, so we need to reload. | 5355 // RecordWriteField clobbers the value register, so we need to reload. |
5360 __ Ret(USE_DELAY_SLOT); | 5356 __ Ret(USE_DELAY_SLOT); |
5361 __ lw(value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); | 5357 __ lw(value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); |
5362 __ bind(¬_mutable_data); | 5358 __ bind(¬_mutable_data); |
5363 | 5359 |
5364 // Check if PropertyCell value matches the new value (relevant for Constant, | 5360 // Check if PropertyCell value matches the new value (relevant for Constant, |
5365 // ConstantType and Undefined cells). | 5361 // ConstantType and Undefined cells). |
5366 Label not_same_value; | 5362 Label not_same_value; |
| 5363 __ lw(cell_value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); |
5367 __ Branch(¬_same_value, ne, value_reg, Operand(cell_value_reg)); | 5364 __ Branch(¬_same_value, ne, value_reg, Operand(cell_value_reg)); |
| 5365 // Make sure the PropertyCell is not marked READ_ONLY. |
| 5366 __ And(at, cell_details_reg, PropertyDetails::kAttributesReadOnlyMask); |
| 5367 __ Branch(&slow_case, ne, at, Operand(zero_reg)); |
5368 if (FLAG_debug_code) { | 5368 if (FLAG_debug_code) { |
5369 Label done; | 5369 Label done; |
5370 // This can only be true for Constant, ConstantType and Undefined cells, | 5370 // This can only be true for Constant, ConstantType and Undefined cells, |
5371 // because we never store the_hole via this stub. | 5371 // because we never store the_hole via this stub. |
5372 __ Branch(&done, eq, cell_details_reg, | 5372 __ Branch(&done, eq, cell_details_reg, |
5373 Operand(PropertyDetails::PropertyCellTypeField::encode( | 5373 Operand(PropertyDetails::PropertyCellTypeField::encode( |
5374 PropertyCellType::kConstant) | | 5374 PropertyCellType::kConstant) | |
5375 PropertyDetails::KindField::encode(kData))); | 5375 PropertyDetails::KindField::encode(kData))); |
5376 __ Branch(&done, eq, cell_details_reg, | 5376 __ Branch(&done, eq, cell_details_reg, |
5377 Operand(PropertyDetails::PropertyCellTypeField::encode( | 5377 Operand(PropertyDetails::PropertyCellTypeField::encode( |
5378 PropertyCellType::kConstantType) | | 5378 PropertyCellType::kConstantType) | |
5379 PropertyDetails::KindField::encode(kData))); | 5379 PropertyDetails::KindField::encode(kData))); |
5380 __ Check(eq, kUnexpectedValue, cell_details_reg, | 5380 __ Check(eq, kUnexpectedValue, cell_details_reg, |
5381 Operand(PropertyDetails::PropertyCellTypeField::encode( | 5381 Operand(PropertyDetails::PropertyCellTypeField::encode( |
5382 PropertyCellType::kUndefined) | | 5382 PropertyCellType::kUndefined) | |
5383 PropertyDetails::KindField::encode(kData))); | 5383 PropertyDetails::KindField::encode(kData))); |
5384 __ bind(&done); | 5384 __ bind(&done); |
5385 } | 5385 } |
5386 __ Ret(); | 5386 __ Ret(); |
5387 __ bind(¬_same_value); | 5387 __ bind(¬_same_value); |
5388 | 5388 |
5389 // Check if PropertyCell contains data with constant type. | 5389 // Check if PropertyCell contains data with constant type (and is not |
| 5390 // READ_ONLY). |
5390 __ Branch(&slow_case, ne, cell_details_reg, | 5391 __ Branch(&slow_case, ne, cell_details_reg, |
5391 Operand(PropertyDetails::PropertyCellTypeField::encode( | 5392 Operand(PropertyDetails::PropertyCellTypeField::encode( |
5392 PropertyCellType::kConstantType) | | 5393 PropertyCellType::kConstantType) | |
5393 PropertyDetails::KindField::encode(kData))); | 5394 PropertyDetails::KindField::encode(kData))); |
5394 | 5395 |
5395 // Now either both old and new values must be SMIs or both must be heap | 5396 // Now either both old and new values must be SMIs or both must be heap |
5396 // objects with same map. | 5397 // objects with same map. |
5397 Label value_is_heap_object; | 5398 Label value_is_heap_object; |
5398 __ JumpIfNotSmi(value_reg, &value_is_heap_object); | 5399 __ JumpIfNotSmi(value_reg, &value_is_heap_object); |
5399 __ JumpIfNotSmi(cell_value_reg, &slow_case); | 5400 __ JumpIfNotSmi(cell_value_reg, &slow_case); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5722 MemOperand(fp, 6 * kPointerSize), NULL); | 5723 MemOperand(fp, 6 * kPointerSize), NULL); |
5723 } | 5724 } |
5724 | 5725 |
5725 | 5726 |
5726 #undef __ | 5727 #undef __ |
5727 | 5728 |
5728 } // namespace internal | 5729 } // namespace internal |
5729 } // namespace v8 | 5730 } // namespace v8 |
5730 | 5731 |
5731 #endif // V8_TARGET_ARCH_MIPS | 5732 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |