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 5255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5266 GenerateCase(masm, FAST_HOLEY_ELEMENTS); | 5266 GenerateCase(masm, FAST_HOLEY_ELEMENTS); |
5267 | 5267 |
5268 __ bind(&fast_elements_case); | 5268 __ bind(&fast_elements_case); |
5269 GenerateCase(masm, FAST_ELEMENTS); | 5269 GenerateCase(masm, FAST_ELEMENTS); |
5270 } | 5270 } |
5271 | 5271 |
5272 | 5272 |
5273 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) { | 5273 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) { |
5274 Register context_reg = cp; | 5274 Register context_reg = cp; |
5275 Register slot_reg = a2; | 5275 Register slot_reg = a2; |
5276 Register name_reg = a3; | |
5277 Register result_reg = v0; | 5276 Register result_reg = v0; |
5278 Label slow_case; | 5277 Label slow_case; |
5279 | 5278 |
5280 // Go up context chain to the script context. | 5279 // Go up context chain to the script context. |
5281 for (int i = 0; i < depth(); ++i) { | 5280 for (int i = 0; i < depth(); ++i) { |
5282 __ lw(result_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); | 5281 __ lw(result_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); |
5283 context_reg = result_reg; | 5282 context_reg = result_reg; |
5284 } | 5283 } |
5285 | 5284 |
5286 // Load the PropertyCell value at the specified slot. | 5285 // Load the PropertyCell value at the specified slot. |
5287 __ sll(at, slot_reg, kPointerSizeLog2); | 5286 __ sll(at, slot_reg, kPointerSizeLog2); |
5288 __ Addu(at, at, Operand(context_reg)); | 5287 __ Addu(at, at, Operand(context_reg)); |
5289 __ Addu(at, at, Context::SlotOffset(0)); | 5288 __ lw(result_reg, ContextOperand(at, 0)); |
5290 __ lw(result_reg, MemOperand(at)); | |
5291 __ lw(result_reg, FieldMemOperand(result_reg, PropertyCell::kValueOffset)); | 5289 __ lw(result_reg, FieldMemOperand(result_reg, PropertyCell::kValueOffset)); |
5292 | 5290 |
5293 // Check that value is not the_hole. | 5291 // Check that value is not the_hole. |
5294 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 5292 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
5295 __ Branch(&slow_case, eq, result_reg, Operand(at)); | 5293 __ Branch(&slow_case, eq, result_reg, Operand(at)); |
5296 __ Ret(); | 5294 __ Ret(); |
5297 | 5295 |
5298 // Fallback to the runtime. | 5296 // Fallback to the runtime. |
5299 __ bind(&slow_case); | 5297 __ bind(&slow_case); |
5300 __ SmiTag(slot_reg); | 5298 __ SmiTag(slot_reg); |
5301 __ Push(slot_reg, name_reg); | 5299 __ Push(slot_reg); |
5302 __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 2, 1); | 5300 __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 1, 1); |
5303 } | 5301 } |
5304 | 5302 |
5305 | 5303 |
5306 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { | 5304 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { |
5307 Register context_reg = cp; | 5305 Register context_reg = cp; |
5308 Register slot_reg = a2; | 5306 Register slot_reg = a2; |
5309 Register name_reg = a3; | |
5310 Register value_reg = a0; | 5307 Register value_reg = a0; |
5311 Register cell_reg = t0; | 5308 Register cell_reg = t0; |
5312 Register cell_value_reg = t1; | 5309 Register cell_value_reg = t1; |
5313 Register cell_details_reg = t2; | 5310 Register cell_details_reg = t2; |
5314 Label fast_heapobject_case, fast_smi_case, slow_case; | 5311 Label fast_heapobject_case, fast_smi_case, slow_case; |
5315 | 5312 |
5316 if (FLAG_debug_code) { | 5313 if (FLAG_debug_code) { |
5317 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 5314 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
5318 __ Check(ne, kUnexpectedValue, value_reg, Operand(at)); | 5315 __ Check(ne, kUnexpectedValue, value_reg, Operand(at)); |
5319 __ AssertName(name_reg); | |
5320 } | 5316 } |
5321 | 5317 |
5322 // Go up context chain to the script context. | 5318 // Go up context chain to the script context. |
5323 for (int i = 0; i < depth(); ++i) { | 5319 for (int i = 0; i < depth(); ++i) { |
5324 __ lw(cell_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); | 5320 __ lw(cell_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); |
5325 context_reg = cell_reg; | 5321 context_reg = cell_reg; |
5326 } | 5322 } |
5327 | 5323 |
5328 // Load the PropertyCell at the specified slot. | 5324 // Load the PropertyCell at the specified slot. |
5329 __ sll(at, slot_reg, kPointerSizeLog2); | 5325 __ sll(at, slot_reg, kPointerSizeLog2); |
5330 __ Addu(at, at, Operand(context_reg)); | 5326 __ Addu(at, at, Operand(context_reg)); |
5331 __ Addu(at, at, Context::SlotOffset(0)); | 5327 __ lw(cell_reg, ContextOperand(at, 0)); |
5332 __ lw(cell_reg, MemOperand(at)); | |
5333 | 5328 |
5334 // Load PropertyDetails for the cell (actually only the cell_type and kind). | 5329 // Load PropertyDetails for the cell (actually only the cell_type and kind). |
5335 __ lw(cell_details_reg, | 5330 __ lw(cell_details_reg, |
5336 FieldMemOperand(cell_reg, PropertyCell::kDetailsOffset)); | 5331 FieldMemOperand(cell_reg, PropertyCell::kDetailsOffset)); |
5337 __ SmiUntag(cell_details_reg); | 5332 __ SmiUntag(cell_details_reg); |
5338 __ And(cell_details_reg, cell_details_reg, | 5333 __ And(cell_details_reg, cell_details_reg, |
5339 PropertyDetails::PropertyCellTypeField::kMask | | 5334 PropertyDetails::PropertyCellTypeField::kMask | |
5340 PropertyDetails::KindField::kMask | | 5335 PropertyDetails::KindField::kMask | |
5341 PropertyDetails::kAttributesReadOnlyMask); | 5336 PropertyDetails::kAttributesReadOnlyMask); |
5342 | 5337 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5406 __ JumpIfSmi(cell_value_reg, &slow_case); | 5401 __ JumpIfSmi(cell_value_reg, &slow_case); |
5407 Register cell_value_map_reg = cell_value_reg; | 5402 Register cell_value_map_reg = cell_value_reg; |
5408 __ lw(cell_value_map_reg, | 5403 __ lw(cell_value_map_reg, |
5409 FieldMemOperand(cell_value_reg, HeapObject::kMapOffset)); | 5404 FieldMemOperand(cell_value_reg, HeapObject::kMapOffset)); |
5410 __ Branch(&fast_heapobject_case, eq, cell_value_map_reg, | 5405 __ Branch(&fast_heapobject_case, eq, cell_value_map_reg, |
5411 FieldMemOperand(value_reg, HeapObject::kMapOffset)); | 5406 FieldMemOperand(value_reg, HeapObject::kMapOffset)); |
5412 | 5407 |
5413 // Fallback to the runtime. | 5408 // Fallback to the runtime. |
5414 __ bind(&slow_case); | 5409 __ bind(&slow_case); |
5415 __ SmiTag(slot_reg); | 5410 __ SmiTag(slot_reg); |
5416 __ Push(slot_reg, name_reg, value_reg); | 5411 __ Push(slot_reg, value_reg); |
5417 __ TailCallRuntime(is_strict(language_mode()) | 5412 __ TailCallRuntime(is_strict(language_mode()) |
5418 ? Runtime::kStoreGlobalViaContext_Strict | 5413 ? Runtime::kStoreGlobalViaContext_Strict |
5419 : Runtime::kStoreGlobalViaContext_Sloppy, | 5414 : Runtime::kStoreGlobalViaContext_Sloppy, |
5420 3, 1); | 5415 2, 1); |
5421 } | 5416 } |
5422 | 5417 |
5423 | 5418 |
5424 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { | 5419 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { |
5425 return ref0.address() - ref1.address(); | 5420 return ref0.address() - ref1.address(); |
5426 } | 5421 } |
5427 | 5422 |
5428 | 5423 |
5429 // Calls an API function. Allocates HandleScope, extracts returned value | 5424 // Calls an API function. Allocates HandleScope, extracts returned value |
5430 // from handle and propagates exceptions. Restores context. stack_space | 5425 // from handle and propagates exceptions. Restores context. stack_space |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5723 MemOperand(fp, 6 * kPointerSize), NULL); | 5718 MemOperand(fp, 6 * kPointerSize), NULL); |
5724 } | 5719 } |
5725 | 5720 |
5726 | 5721 |
5727 #undef __ | 5722 #undef __ |
5728 | 5723 |
5729 } // namespace internal | 5724 } // namespace internal |
5730 } // namespace v8 | 5725 } // namespace v8 |
5731 | 5726 |
5732 #endif // V8_TARGET_ARCH_MIPS | 5727 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |