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 5286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5297 GenerateCase(masm, FAST_HOLEY_ELEMENTS); | 5297 GenerateCase(masm, FAST_HOLEY_ELEMENTS); |
5298 | 5298 |
5299 __ bind(&fast_elements_case); | 5299 __ bind(&fast_elements_case); |
5300 GenerateCase(masm, FAST_ELEMENTS); | 5300 GenerateCase(masm, FAST_ELEMENTS); |
5301 } | 5301 } |
5302 | 5302 |
5303 | 5303 |
5304 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) { | 5304 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) { |
5305 Register context_reg = cp; | 5305 Register context_reg = cp; |
5306 Register slot_reg = a2; | 5306 Register slot_reg = a2; |
5307 Register name_reg = a3; | |
5308 Register result_reg = v0; | 5307 Register result_reg = v0; |
5309 Label slow_case; | 5308 Label slow_case; |
5310 | 5309 |
5311 // Go up context chain to the script context. | 5310 // Go up context chain to the script context. |
5312 for (int i = 0; i < depth(); ++i) { | 5311 for (int i = 0; i < depth(); ++i) { |
5313 __ ld(result_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); | 5312 __ ld(result_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); |
5314 context_reg = result_reg; | 5313 context_reg = result_reg; |
5315 } | 5314 } |
5316 | 5315 |
5317 // Load the PropertyCell value at the specified slot. | 5316 // Load the PropertyCell value at the specified slot. |
5318 __ dsll(at, slot_reg, kPointerSizeLog2); | 5317 __ dsll(at, slot_reg, kPointerSizeLog2); |
5319 __ Daddu(at, at, Operand(context_reg)); | 5318 __ Daddu(at, at, Operand(context_reg)); |
5320 __ Daddu(at, at, Context::SlotOffset(0)); | 5319 __ ld(result_reg, ContextOperand(at, 0)); |
5321 __ ld(result_reg, MemOperand(at)); | |
5322 __ ld(result_reg, FieldMemOperand(result_reg, PropertyCell::kValueOffset)); | 5320 __ ld(result_reg, FieldMemOperand(result_reg, PropertyCell::kValueOffset)); |
5323 | 5321 |
5324 // Check that value is not the_hole. | 5322 // Check that value is not the_hole. |
5325 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 5323 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
5326 __ Branch(&slow_case, eq, result_reg, Operand(at)); | 5324 __ Branch(&slow_case, eq, result_reg, Operand(at)); |
5327 __ Ret(); | 5325 __ Ret(); |
5328 | 5326 |
5329 // Fallback to the runtime. | 5327 // Fallback to the runtime. |
5330 __ bind(&slow_case); | 5328 __ bind(&slow_case); |
5331 __ SmiTag(slot_reg); | 5329 __ SmiTag(slot_reg); |
5332 __ Push(slot_reg, name_reg); | 5330 __ Push(slot_reg); |
5333 __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 2, 1); | 5331 __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 1, 1); |
5334 } | 5332 } |
5335 | 5333 |
5336 | 5334 |
5337 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { | 5335 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { |
5338 Register context_reg = cp; | 5336 Register context_reg = cp; |
5339 Register slot_reg = a2; | 5337 Register slot_reg = a2; |
5340 Register name_reg = a3; | |
5341 Register value_reg = a0; | 5338 Register value_reg = a0; |
5342 Register cell_reg = a4; | 5339 Register cell_reg = a4; |
5343 Register cell_value_reg = a5; | 5340 Register cell_value_reg = a5; |
5344 Register cell_details_reg = a6; | 5341 Register cell_details_reg = a6; |
5345 Label fast_heapobject_case, fast_smi_case, slow_case; | 5342 Label fast_heapobject_case, fast_smi_case, slow_case; |
5346 | 5343 |
5347 if (FLAG_debug_code) { | 5344 if (FLAG_debug_code) { |
5348 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 5345 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
5349 __ Check(ne, kUnexpectedValue, value_reg, Operand(at)); | 5346 __ Check(ne, kUnexpectedValue, value_reg, Operand(at)); |
5350 __ AssertName(name_reg); | |
5351 } | 5347 } |
5352 | 5348 |
5353 // Go up context chain to the script context. | 5349 // Go up context chain to the script context. |
5354 for (int i = 0; i < depth(); ++i) { | 5350 for (int i = 0; i < depth(); ++i) { |
5355 __ ld(cell_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); | 5351 __ ld(cell_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); |
5356 context_reg = cell_reg; | 5352 context_reg = cell_reg; |
5357 } | 5353 } |
5358 | 5354 |
5359 // Load the PropertyCell at the specified slot. | 5355 // Load the PropertyCell at the specified slot. |
5360 __ dsll(at, slot_reg, kPointerSizeLog2); | 5356 __ dsll(at, slot_reg, kPointerSizeLog2); |
5361 __ Daddu(at, at, Operand(context_reg)); | 5357 __ Daddu(at, at, Operand(context_reg)); |
5362 __ Daddu(at, at, Context::SlotOffset(0)); | 5358 __ ld(cell_reg, ContextOperand(at, 0)); |
5363 __ ld(cell_reg, MemOperand(at)); | |
5364 | 5359 |
5365 // Load PropertyDetails for the cell (actually only the cell_type and kind). | 5360 // Load PropertyDetails for the cell (actually only the cell_type and kind). |
5366 __ ld(cell_details_reg, | 5361 __ ld(cell_details_reg, |
5367 FieldMemOperand(cell_reg, PropertyCell::kDetailsOffset)); | 5362 FieldMemOperand(cell_reg, PropertyCell::kDetailsOffset)); |
5368 __ SmiUntag(cell_details_reg); | 5363 __ SmiUntag(cell_details_reg); |
5369 __ And(cell_details_reg, cell_details_reg, | 5364 __ And(cell_details_reg, cell_details_reg, |
5370 PropertyDetails::PropertyCellTypeField::kMask | | 5365 PropertyDetails::PropertyCellTypeField::kMask | |
5371 PropertyDetails::KindField::kMask | | 5366 PropertyDetails::KindField::kMask | |
5372 PropertyDetails::kAttributesReadOnlyMask); | 5367 PropertyDetails::kAttributesReadOnlyMask); |
5373 | 5368 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5437 __ JumpIfSmi(cell_value_reg, &slow_case); | 5432 __ JumpIfSmi(cell_value_reg, &slow_case); |
5438 Register cell_value_map_reg = cell_value_reg; | 5433 Register cell_value_map_reg = cell_value_reg; |
5439 __ ld(cell_value_map_reg, | 5434 __ ld(cell_value_map_reg, |
5440 FieldMemOperand(cell_value_reg, HeapObject::kMapOffset)); | 5435 FieldMemOperand(cell_value_reg, HeapObject::kMapOffset)); |
5441 __ Branch(&fast_heapobject_case, eq, cell_value_map_reg, | 5436 __ Branch(&fast_heapobject_case, eq, cell_value_map_reg, |
5442 FieldMemOperand(value_reg, HeapObject::kMapOffset)); | 5437 FieldMemOperand(value_reg, HeapObject::kMapOffset)); |
5443 | 5438 |
5444 // Fallback to the runtime. | 5439 // Fallback to the runtime. |
5445 __ bind(&slow_case); | 5440 __ bind(&slow_case); |
5446 __ SmiTag(slot_reg); | 5441 __ SmiTag(slot_reg); |
5447 __ Push(slot_reg, name_reg, value_reg); | 5442 __ Push(slot_reg, value_reg); |
5448 __ TailCallRuntime(is_strict(language_mode()) | 5443 __ TailCallRuntime(is_strict(language_mode()) |
5449 ? Runtime::kStoreGlobalViaContext_Strict | 5444 ? Runtime::kStoreGlobalViaContext_Strict |
5450 : Runtime::kStoreGlobalViaContext_Sloppy, | 5445 : Runtime::kStoreGlobalViaContext_Sloppy, |
5451 3, 1); | 5446 2, 1); |
5452 } | 5447 } |
5453 | 5448 |
5454 | 5449 |
5455 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { | 5450 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { |
5456 int64_t offset = (ref0.address() - ref1.address()); | 5451 int64_t offset = (ref0.address() - ref1.address()); |
5457 DCHECK(static_cast<int>(offset) == offset); | 5452 DCHECK(static_cast<int>(offset) == offset); |
5458 return static_cast<int>(offset); | 5453 return static_cast<int>(offset); |
5459 } | 5454 } |
5460 | 5455 |
5461 | 5456 |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5755 MemOperand(fp, 6 * kPointerSize), NULL); | 5750 MemOperand(fp, 6 * kPointerSize), NULL); |
5756 } | 5751 } |
5757 | 5752 |
5758 | 5753 |
5759 #undef __ | 5754 #undef __ |
5760 | 5755 |
5761 } // namespace internal | 5756 } // namespace internal |
5762 } // namespace v8 | 5757 } // namespace v8 |
5763 | 5758 |
5764 #endif // V8_TARGET_ARCH_MIPS64 | 5759 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |