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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 5322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5333 __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 2, 1); | 5333 __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 2, 1); |
5334 } | 5334 } |
5335 | 5335 |
5336 | 5336 |
5337 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { | 5337 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { |
5338 Register context_reg = cp; | 5338 Register context_reg = cp; |
5339 Register slot_reg = a2; | 5339 Register slot_reg = a2; |
5340 Register name_reg = a3; | 5340 Register name_reg = a3; |
5341 Register value_reg = a0; | 5341 Register value_reg = a0; |
5342 Register cell_reg = a4; | 5342 Register cell_reg = a4; |
5343 Register cell_details_reg = a5; | 5343 Register cell_value_reg = a5; |
| 5344 Register cell_details_reg = a6; |
5344 Label fast_heapobject_case, fast_smi_case, slow_case; | 5345 Label fast_heapobject_case, fast_smi_case, slow_case; |
5345 | 5346 |
5346 if (FLAG_debug_code) { | 5347 if (FLAG_debug_code) { |
5347 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 5348 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
5348 __ Check(ne, kUnexpectedValue, value_reg, Operand(at)); | 5349 __ Check(ne, kUnexpectedValue, value_reg, Operand(at)); |
5349 __ AssertName(name_reg); | 5350 __ AssertName(name_reg); |
5350 } | 5351 } |
5351 | 5352 |
5352 // Go up context chain to the script context. | 5353 // Go up context chain to the script context. |
5353 for (int i = 0; i < depth(); ++i) { | 5354 for (int i = 0; i < depth(); ++i) { |
5354 __ ld(cell_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); | 5355 __ ld(cell_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); |
5355 context_reg = cell_reg; | 5356 context_reg = cell_reg; |
5356 } | 5357 } |
5357 | 5358 |
5358 // Load the PropertyCell at the specified slot. | 5359 // Load the PropertyCell at the specified slot. |
5359 __ dsll(at, slot_reg, kPointerSizeLog2); | 5360 __ dsll(at, slot_reg, kPointerSizeLog2); |
5360 __ Daddu(at, at, Operand(context_reg)); | 5361 __ Daddu(at, at, Operand(context_reg)); |
5361 __ Daddu(at, at, Context::SlotOffset(0)); | 5362 __ Daddu(at, at, Context::SlotOffset(0)); |
5362 __ ld(cell_reg, MemOperand(at)); | 5363 __ ld(cell_reg, MemOperand(at)); |
5363 | 5364 |
| 5365 // Check that cell value is not the_hole. |
| 5366 __ ld(cell_value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); |
| 5367 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
| 5368 __ Branch(&slow_case, eq, cell_value_reg, Operand(at)); |
| 5369 |
5364 // Load PropertyDetails for the cell (actually only the cell_type and kind). | 5370 // Load PropertyDetails for the cell (actually only the cell_type and kind). |
5365 __ ld(cell_details_reg, | 5371 __ ld(cell_details_reg, |
5366 FieldMemOperand(cell_reg, PropertyCell::kDetailsOffset)); | 5372 FieldMemOperand(cell_reg, PropertyCell::kDetailsOffset)); |
5367 __ SmiUntag(cell_details_reg); | 5373 __ SmiUntag(cell_details_reg); |
5368 __ And(cell_details_reg, cell_details_reg, | 5374 __ And(cell_details_reg, cell_details_reg, |
5369 PropertyDetails::PropertyCellTypeField::kMask | | 5375 PropertyDetails::PropertyCellTypeField::kMask | |
5370 PropertyDetails::KindField::kMask); | 5376 PropertyDetails::KindField::kMask); |
5371 | 5377 |
5372 // Check if PropertyCell holds mutable data. | 5378 // Check if PropertyCell holds mutable data. |
5373 Label not_mutable_data; | 5379 Label not_mutable_data; |
5374 __ Branch(¬_mutable_data, ne, cell_details_reg, | 5380 __ Branch(¬_mutable_data, ne, cell_details_reg, |
5375 Operand(PropertyDetails::PropertyCellTypeField::encode( | 5381 Operand(PropertyDetails::PropertyCellTypeField::encode( |
5376 PropertyCellType::kMutable) | | 5382 PropertyCellType::kMutable) | |
5377 PropertyDetails::KindField::encode(kData))); | 5383 PropertyDetails::KindField::encode(kData))); |
5378 __ JumpIfSmi(value_reg, &fast_smi_case); | 5384 __ JumpIfSmi(value_reg, &fast_smi_case); |
5379 __ bind(&fast_heapobject_case); | 5385 __ bind(&fast_heapobject_case); |
5380 __ sd(value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); | 5386 __ sd(value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); |
5381 __ RecordWriteField(cell_reg, PropertyCell::kValueOffset, value_reg, | 5387 __ RecordWriteField(cell_reg, PropertyCell::kValueOffset, value_reg, |
5382 cell_details_reg, kRAHasNotBeenSaved, kDontSaveFPRegs, | 5388 cell_details_reg, kRAHasNotBeenSaved, kDontSaveFPRegs, |
5383 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | 5389 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
5384 // RecordWriteField clobbers the value register, so we need to reload. | 5390 // RecordWriteField clobbers the value register, so we need to reload. |
5385 __ Ret(USE_DELAY_SLOT); | 5391 __ Ret(USE_DELAY_SLOT); |
5386 __ ld(value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); | 5392 __ ld(value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); |
5387 __ bind(¬_mutable_data); | 5393 __ bind(¬_mutable_data); |
5388 | 5394 |
5389 // Check if PropertyCell value matches the new value (relevant for Constant, | 5395 // Check if PropertyCell value matches the new value (relevant for Constant, |
5390 // ConstantType and Undefined cells). | 5396 // ConstantType and Undefined cells). |
5391 Label not_same_value; | 5397 Label not_same_value; |
5392 __ ld(at, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); | 5398 __ Branch(¬_same_value, ne, value_reg, Operand(cell_value_reg)); |
5393 __ Branch(¬_same_value, ne, value_reg, Operand(at)); | |
5394 if (FLAG_debug_code) { | 5399 if (FLAG_debug_code) { |
5395 Label done; | 5400 Label done; |
5396 // This can only be true for Constant, ConstantType and Undefined cells, | 5401 // This can only be true for Constant, ConstantType and Undefined cells, |
5397 // because we never store the_hole via this stub. | 5402 // because we never store the_hole via this stub. |
5398 __ Branch(&done, eq, cell_details_reg, | 5403 __ Branch(&done, eq, cell_details_reg, |
5399 Operand(PropertyDetails::PropertyCellTypeField::encode( | 5404 Operand(PropertyDetails::PropertyCellTypeField::encode( |
5400 PropertyCellType::kConstant) | | 5405 PropertyCellType::kConstant) | |
5401 PropertyDetails::KindField::encode(kData))); | 5406 PropertyDetails::KindField::encode(kData))); |
5402 __ Branch(&done, eq, cell_details_reg, | 5407 __ Branch(&done, eq, cell_details_reg, |
5403 Operand(PropertyDetails::PropertyCellTypeField::encode( | 5408 Operand(PropertyDetails::PropertyCellTypeField::encode( |
(...skipping 10 matching lines...) Expand all Loading... |
5414 | 5419 |
5415 // Check if PropertyCell contains data with constant type. | 5420 // Check if PropertyCell contains data with constant type. |
5416 __ Branch(&slow_case, ne, cell_details_reg, | 5421 __ Branch(&slow_case, ne, cell_details_reg, |
5417 Operand(PropertyDetails::PropertyCellTypeField::encode( | 5422 Operand(PropertyDetails::PropertyCellTypeField::encode( |
5418 PropertyCellType::kConstantType) | | 5423 PropertyCellType::kConstantType) | |
5419 PropertyDetails::KindField::encode(kData))); | 5424 PropertyDetails::KindField::encode(kData))); |
5420 | 5425 |
5421 // Now either both old and new values must be SMIs or both must be heap | 5426 // Now either both old and new values must be SMIs or both must be heap |
5422 // objects with same map. | 5427 // objects with same map. |
5423 Label value_is_heap_object; | 5428 Label value_is_heap_object; |
5424 Register cell_value_reg = cell_details_reg; | |
5425 __ ld(cell_value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); | |
5426 __ JumpIfNotSmi(value_reg, &value_is_heap_object); | 5429 __ JumpIfNotSmi(value_reg, &value_is_heap_object); |
5427 __ JumpIfNotSmi(cell_value_reg, &slow_case); | 5430 __ JumpIfNotSmi(cell_value_reg, &slow_case); |
5428 // Old and new values are SMIs, no need for a write barrier here. | 5431 // Old and new values are SMIs, no need for a write barrier here. |
5429 __ bind(&fast_smi_case); | 5432 __ bind(&fast_smi_case); |
5430 __ Ret(USE_DELAY_SLOT); | 5433 __ Ret(USE_DELAY_SLOT); |
5431 __ sd(value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); | 5434 __ sd(value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); |
5432 __ bind(&value_is_heap_object); | 5435 __ bind(&value_is_heap_object); |
5433 __ JumpIfSmi(cell_value_reg, &slow_case); | 5436 __ JumpIfSmi(cell_value_reg, &slow_case); |
5434 Register cell_value_map_reg = cell_value_reg; | 5437 Register cell_value_map_reg = cell_value_reg; |
5435 __ ld(cell_value_map_reg, | 5438 __ ld(cell_value_map_reg, |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5751 MemOperand(fp, 6 * kPointerSize), NULL); | 5754 MemOperand(fp, 6 * kPointerSize), NULL); |
5752 } | 5755 } |
5753 | 5756 |
5754 | 5757 |
5755 #undef __ | 5758 #undef __ |
5756 | 5759 |
5757 } // namespace internal | 5760 } // namespace internal |
5758 } // namespace v8 | 5761 } // namespace v8 |
5759 | 5762 |
5760 #endif // V8_TARGET_ARCH_MIPS64 | 5763 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |