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 // Check that cell value is not the_hole. | 5360 // Check that cell value is not the_hole. |
5366 __ ld(cell_value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); | 5361 __ ld(cell_value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); |
5367 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 5362 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
5368 __ Branch(&slow_case, eq, cell_value_reg, Operand(at)); | 5363 __ Branch(&slow_case, eq, cell_value_reg, Operand(at)); |
5369 | 5364 |
5370 // Load PropertyDetails for the cell (actually only the cell_type and kind). | 5365 // Load PropertyDetails for the cell (actually only the cell_type and kind). |
5371 __ ld(cell_details_reg, | 5366 __ ld(cell_details_reg, |
5372 FieldMemOperand(cell_reg, PropertyCell::kDetailsOffset)); | 5367 FieldMemOperand(cell_reg, PropertyCell::kDetailsOffset)); |
5373 __ SmiUntag(cell_details_reg); | 5368 __ SmiUntag(cell_details_reg); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5436 __ JumpIfSmi(cell_value_reg, &slow_case); | 5431 __ JumpIfSmi(cell_value_reg, &slow_case); |
5437 Register cell_value_map_reg = cell_value_reg; | 5432 Register cell_value_map_reg = cell_value_reg; |
5438 __ ld(cell_value_map_reg, | 5433 __ ld(cell_value_map_reg, |
5439 FieldMemOperand(cell_value_reg, HeapObject::kMapOffset)); | 5434 FieldMemOperand(cell_value_reg, HeapObject::kMapOffset)); |
5440 __ Branch(&fast_heapobject_case, eq, cell_value_map_reg, | 5435 __ Branch(&fast_heapobject_case, eq, cell_value_map_reg, |
5441 FieldMemOperand(value_reg, HeapObject::kMapOffset)); | 5436 FieldMemOperand(value_reg, HeapObject::kMapOffset)); |
5442 | 5437 |
5443 // Fallback to the runtime. | 5438 // Fallback to the runtime. |
5444 __ bind(&slow_case); | 5439 __ bind(&slow_case); |
5445 __ SmiTag(slot_reg); | 5440 __ SmiTag(slot_reg); |
5446 __ Push(slot_reg, name_reg, value_reg); | 5441 __ Push(slot_reg, value_reg); |
5447 __ TailCallRuntime(is_strict(language_mode()) | 5442 __ TailCallRuntime(is_strict(language_mode()) |
5448 ? Runtime::kStoreGlobalViaContext_Strict | 5443 ? Runtime::kStoreGlobalViaContext_Strict |
5449 : Runtime::kStoreGlobalViaContext_Sloppy, | 5444 : Runtime::kStoreGlobalViaContext_Sloppy, |
5450 3, 1); | 5445 2, 1); |
5451 } | 5446 } |
5452 | 5447 |
5453 | 5448 |
5454 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { | 5449 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { |
5455 int64_t offset = (ref0.address() - ref1.address()); | 5450 int64_t offset = (ref0.address() - ref1.address()); |
5456 DCHECK(static_cast<int>(offset) == offset); | 5451 DCHECK(static_cast<int>(offset) == offset); |
5457 return static_cast<int>(offset); | 5452 return static_cast<int>(offset); |
5458 } | 5453 } |
5459 | 5454 |
5460 | 5455 |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5754 MemOperand(fp, 6 * kPointerSize), NULL); | 5749 MemOperand(fp, 6 * kPointerSize), NULL); |
5755 } | 5750 } |
5756 | 5751 |
5757 | 5752 |
5758 #undef __ | 5753 #undef __ |
5759 | 5754 |
5760 } // namespace internal | 5755 } // namespace internal |
5761 } // namespace v8 | 5756 } // namespace v8 |
5762 | 5757 |
5763 #endif // V8_TARGET_ARCH_MIPS64 | 5758 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |