| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 7 #if V8_TARGET_ARCH_PPC |
| 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 5359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5370 for (int i = 0; i < depth(); i++) { | 5370 for (int i = 0; i < depth(); i++) { |
| 5371 __ LoadP(context_temp, ContextOperand(context, Context::PREVIOUS_INDEX)); | 5371 __ LoadP(context_temp, ContextOperand(context, Context::PREVIOUS_INDEX)); |
| 5372 context = context_temp; | 5372 context = context_temp; |
| 5373 } | 5373 } |
| 5374 | 5374 |
| 5375 // Load the PropertyCell at the specified slot. | 5375 // Load the PropertyCell at the specified slot. |
| 5376 __ ShiftLeftImm(r0, slot, Operand(kPointerSizeLog2)); | 5376 __ ShiftLeftImm(r0, slot, Operand(kPointerSizeLog2)); |
| 5377 __ add(cell, context, r0); | 5377 __ add(cell, context, r0); |
| 5378 __ LoadP(cell, ContextOperand(cell)); | 5378 __ LoadP(cell, ContextOperand(cell)); |
| 5379 | 5379 |
| 5380 // Check that cell value is not the_hole. | |
| 5381 __ LoadP(cell_value, FieldMemOperand(cell, PropertyCell::kValueOffset)); | |
| 5382 __ CompareRoot(cell_value, Heap::kTheHoleValueRootIndex); | |
| 5383 __ beq(&slow_case); | |
| 5384 | |
| 5385 // Load PropertyDetails for the cell (actually only the cell_type and kind). | 5380 // Load PropertyDetails for the cell (actually only the cell_type and kind). |
| 5386 __ LoadP(cell_details, FieldMemOperand(cell, PropertyCell::kDetailsOffset)); | 5381 __ LoadP(cell_details, FieldMemOperand(cell, PropertyCell::kDetailsOffset)); |
| 5387 __ SmiUntag(cell_details); | 5382 __ SmiUntag(cell_details); |
| 5388 __ andi(cell_details, cell_details, | 5383 __ andi(cell_details, cell_details, |
| 5389 Operand(PropertyDetails::PropertyCellTypeField::kMask | | 5384 Operand(PropertyDetails::PropertyCellTypeField::kMask | |
| 5390 PropertyDetails::KindField::kMask)); | 5385 PropertyDetails::KindField::kMask | |
| 5386 PropertyDetails::kAttributesReadOnlyMask)); |
| 5391 | 5387 |
| 5392 // Check if PropertyCell holds mutable data. | 5388 // Check if PropertyCell holds mutable data. |
| 5393 Label not_mutable_data; | 5389 Label not_mutable_data; |
| 5394 __ cmpi(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode( | 5390 __ cmpi(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode( |
| 5395 PropertyCellType::kMutable) | | 5391 PropertyCellType::kMutable) | |
| 5396 PropertyDetails::KindField::encode(kData))); | 5392 PropertyDetails::KindField::encode(kData))); |
| 5397 __ bne(¬_mutable_data); | 5393 __ bne(¬_mutable_data); |
| 5398 __ JumpIfSmi(value, &fast_smi_case); | 5394 __ JumpIfSmi(value, &fast_smi_case); |
| 5399 | 5395 |
| 5400 __ bind(&fast_heapobject_case); | 5396 __ bind(&fast_heapobject_case); |
| 5401 __ StoreP(value, FieldMemOperand(cell, PropertyCell::kValueOffset), r0); | 5397 __ StoreP(value, FieldMemOperand(cell, PropertyCell::kValueOffset), r0); |
| 5402 // RecordWriteField clobbers the value register, so we copy it before the | 5398 // RecordWriteField clobbers the value register, so we copy it before the |
| 5403 // call. | 5399 // call. |
| 5404 __ mr(r7, value); | 5400 __ mr(r7, value); |
| 5405 __ RecordWriteField(cell, PropertyCell::kValueOffset, r7, scratch, | 5401 __ RecordWriteField(cell, PropertyCell::kValueOffset, r7, scratch, |
| 5406 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, | 5402 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, |
| 5407 OMIT_SMI_CHECK); | 5403 OMIT_SMI_CHECK); |
| 5408 __ Ret(); | 5404 __ Ret(); |
| 5409 | 5405 |
| 5410 __ bind(¬_mutable_data); | 5406 __ bind(¬_mutable_data); |
| 5411 // Check if PropertyCell value matches the new value (relevant for Constant, | 5407 // Check if PropertyCell value matches the new value (relevant for Constant, |
| 5412 // ConstantType and Undefined cells). | 5408 // ConstantType and Undefined cells). |
| 5413 Label not_same_value; | 5409 Label not_same_value; |
| 5410 __ LoadP(cell_value, FieldMemOperand(cell, PropertyCell::kValueOffset)); |
| 5414 __ cmp(cell_value, value); | 5411 __ cmp(cell_value, value); |
| 5415 __ bne(¬_same_value); | 5412 __ bne(¬_same_value); |
| 5416 | 5413 |
| 5414 // Make sure the PropertyCell is not marked READ_ONLY. |
| 5415 __ andi(r0, cell_details, Operand(PropertyDetails::kAttributesReadOnlyMask)); |
| 5416 __ bne(&slow_case, cr0); |
| 5417 |
| 5417 if (FLAG_debug_code) { | 5418 if (FLAG_debug_code) { |
| 5418 Label done; | 5419 Label done; |
| 5419 // This can only be true for Constant, ConstantType and Undefined cells, | 5420 // This can only be true for Constant, ConstantType and Undefined cells, |
| 5420 // because we never store the_hole via this stub. | 5421 // because we never store the_hole via this stub. |
| 5421 __ cmpi(cell_details, | 5422 __ cmpi(cell_details, |
| 5422 Operand(PropertyDetails::PropertyCellTypeField::encode( | 5423 Operand(PropertyDetails::PropertyCellTypeField::encode( |
| 5423 PropertyCellType::kConstant) | | 5424 PropertyCellType::kConstant) | |
| 5424 PropertyDetails::KindField::encode(kData))); | 5425 PropertyDetails::KindField::encode(kData))); |
| 5425 __ beq(&done); | 5426 __ beq(&done); |
| 5426 __ cmpi(cell_details, | 5427 __ cmpi(cell_details, |
| 5427 Operand(PropertyDetails::PropertyCellTypeField::encode( | 5428 Operand(PropertyDetails::PropertyCellTypeField::encode( |
| 5428 PropertyCellType::kConstantType) | | 5429 PropertyCellType::kConstantType) | |
| 5429 PropertyDetails::KindField::encode(kData))); | 5430 PropertyDetails::KindField::encode(kData))); |
| 5430 __ beq(&done); | 5431 __ beq(&done); |
| 5431 __ cmpi(cell_details, | 5432 __ cmpi(cell_details, |
| 5432 Operand(PropertyDetails::PropertyCellTypeField::encode( | 5433 Operand(PropertyDetails::PropertyCellTypeField::encode( |
| 5433 PropertyCellType::kUndefined) | | 5434 PropertyCellType::kUndefined) | |
| 5434 PropertyDetails::KindField::encode(kData))); | 5435 PropertyDetails::KindField::encode(kData))); |
| 5435 __ Check(eq, kUnexpectedValue); | 5436 __ Check(eq, kUnexpectedValue); |
| 5436 __ bind(&done); | 5437 __ bind(&done); |
| 5437 } | 5438 } |
| 5438 __ Ret(); | 5439 __ Ret(); |
| 5439 __ bind(¬_same_value); | 5440 __ bind(¬_same_value); |
| 5440 | 5441 |
| 5441 // Check if PropertyCell contains data with constant type. | 5442 // Check if PropertyCell contains data with constant type (and is not |
| 5443 // READ_ONLY). |
| 5442 __ cmpi(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode( | 5444 __ cmpi(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode( |
| 5443 PropertyCellType::kConstantType) | | 5445 PropertyCellType::kConstantType) | |
| 5444 PropertyDetails::KindField::encode(kData))); | 5446 PropertyDetails::KindField::encode(kData))); |
| 5445 __ bne(&slow_case); | 5447 __ bne(&slow_case); |
| 5446 | 5448 |
| 5447 // Now either both old and new values must be smis or both must be heap | 5449 // Now either both old and new values must be smis or both must be heap |
| 5448 // objects with same map. | 5450 // objects with same map. |
| 5449 Label value_is_heap_object; | 5451 Label value_is_heap_object; |
| 5450 __ JumpIfNotSmi(value, &value_is_heap_object); | 5452 __ JumpIfNotSmi(value, &value_is_heap_object); |
| 5451 __ JumpIfNotSmi(cell_value, &slow_case); | 5453 __ JumpIfNotSmi(cell_value, &slow_case); |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5830 kStackUnwindSpace, NULL, | 5832 kStackUnwindSpace, NULL, |
| 5831 MemOperand(fp, 6 * kPointerSize), NULL); | 5833 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5832 } | 5834 } |
| 5833 | 5835 |
| 5834 | 5836 |
| 5835 #undef __ | 5837 #undef __ |
| 5836 } // namespace internal | 5838 } // namespace internal |
| 5837 } // namespace v8 | 5839 } // namespace v8 |
| 5838 | 5840 |
| 5839 #endif // V8_TARGET_ARCH_PPC | 5841 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |