| 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_details_reg = t1; | 5309 Register cell_details_reg = t1; |
| 5310 Register cell_value_reg = a3; |
| 5313 Label fast_heapobject_case, fast_smi_case, slow_case; | 5311 Label fast_heapobject_case, fast_smi_case, slow_case; |
| 5314 | 5312 |
| 5315 if (FLAG_debug_code) { | 5313 if (FLAG_debug_code) { |
| 5316 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 5314 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
| 5317 __ Check(ne, kUnexpectedValue, value_reg, Operand(at)); | 5315 __ Check(ne, kUnexpectedValue, value_reg, Operand(at)); |
| 5318 __ AssertName(name_reg); | |
| 5319 } | 5316 } |
| 5320 | 5317 |
| 5321 // Go up context chain to the script context. | 5318 // Go up context chain to the script context. |
| 5322 for (int i = 0; i < depth(); ++i) { | 5319 for (int i = 0; i < depth(); ++i) { |
| 5323 __ lw(cell_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); | 5320 __ lw(cell_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); |
| 5324 context_reg = cell_reg; | 5321 context_reg = cell_reg; |
| 5325 } | 5322 } |
| 5326 | 5323 |
| 5327 // Load the PropertyCell at the specified slot. | 5324 // Load the PropertyCell at the specified slot. |
| 5328 __ sll(at, slot_reg, kPointerSizeLog2); | 5325 __ sll(at, slot_reg, kPointerSizeLog2); |
| 5329 __ Addu(at, at, Operand(context_reg)); | 5326 __ Addu(at, at, Operand(context_reg)); |
| 5330 __ Addu(at, at, Context::SlotOffset(0)); | 5327 __ lw(cell_reg, ContextOperand(at, 0)); |
| 5331 __ lw(cell_reg, MemOperand(at)); | |
| 5332 | 5328 |
| 5333 // 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). |
| 5334 __ lw(cell_details_reg, | 5330 __ lw(cell_details_reg, |
| 5335 FieldMemOperand(cell_reg, PropertyCell::kDetailsOffset)); | 5331 FieldMemOperand(cell_reg, PropertyCell::kDetailsOffset)); |
| 5336 __ SmiUntag(cell_details_reg); | 5332 __ SmiUntag(cell_details_reg); |
| 5337 __ And(cell_details_reg, cell_details_reg, | 5333 __ And(cell_details_reg, cell_details_reg, |
| 5338 PropertyDetails::PropertyCellTypeField::kMask | | 5334 PropertyDetails::PropertyCellTypeField::kMask | |
| 5339 PropertyDetails::KindField::kMask); | 5335 PropertyDetails::KindField::kMask); |
| 5340 | 5336 |
| 5341 // Check if PropertyCell holds mutable data. | 5337 // Check if PropertyCell holds mutable data. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5383 | 5379 |
| 5384 // Check if PropertyCell contains data with constant type. | 5380 // Check if PropertyCell contains data with constant type. |
| 5385 __ Branch(&slow_case, ne, cell_details_reg, | 5381 __ Branch(&slow_case, ne, cell_details_reg, |
| 5386 Operand(PropertyDetails::PropertyCellTypeField::encode( | 5382 Operand(PropertyDetails::PropertyCellTypeField::encode( |
| 5387 PropertyCellType::kConstantType) | | 5383 PropertyCellType::kConstantType) | |
| 5388 PropertyDetails::KindField::encode(kData))); | 5384 PropertyDetails::KindField::encode(kData))); |
| 5389 | 5385 |
| 5390 // Now either both old and new values must be SMIs or both must be heap | 5386 // Now either both old and new values must be SMIs or both must be heap |
| 5391 // objects with same map. | 5387 // objects with same map. |
| 5392 Label value_is_heap_object; | 5388 Label value_is_heap_object; |
| 5393 Register cell_value_reg = cell_details_reg; | |
| 5394 __ lw(cell_value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); | 5389 __ lw(cell_value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); |
| 5395 __ JumpIfNotSmi(value_reg, &value_is_heap_object); | 5390 __ JumpIfNotSmi(value_reg, &value_is_heap_object); |
| 5396 __ JumpIfNotSmi(cell_value_reg, &slow_case); | 5391 __ JumpIfNotSmi(cell_value_reg, &slow_case); |
| 5397 // Old and new values are SMIs, no need for a write barrier here. | 5392 // Old and new values are SMIs, no need for a write barrier here. |
| 5398 __ bind(&fast_smi_case); | 5393 __ bind(&fast_smi_case); |
| 5399 __ Ret(USE_DELAY_SLOT); | 5394 __ Ret(USE_DELAY_SLOT); |
| 5400 __ sw(value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); | 5395 __ sw(value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); |
| 5401 __ bind(&value_is_heap_object); | 5396 __ bind(&value_is_heap_object); |
| 5402 __ JumpIfSmi(cell_value_reg, &slow_case); | 5397 __ JumpIfSmi(cell_value_reg, &slow_case); |
| 5403 Register cell_value_map_reg = cell_value_reg; | 5398 Register cell_value_map_reg = cell_value_reg; |
| 5404 __ lw(cell_value_map_reg, | 5399 __ lw(cell_value_map_reg, |
| 5405 FieldMemOperand(cell_value_reg, HeapObject::kMapOffset)); | 5400 FieldMemOperand(cell_value_reg, HeapObject::kMapOffset)); |
| 5406 __ Branch(&fast_heapobject_case, eq, cell_value_map_reg, | 5401 __ Branch(&fast_heapobject_case, eq, cell_value_map_reg, |
| 5407 FieldMemOperand(value_reg, HeapObject::kMapOffset)); | 5402 FieldMemOperand(value_reg, HeapObject::kMapOffset)); |
| 5408 | 5403 |
| 5409 // Fallback to the runtime. | 5404 // Fallback to the runtime. |
| 5410 __ bind(&slow_case); | 5405 __ bind(&slow_case); |
| 5411 __ SmiTag(slot_reg); | 5406 __ SmiTag(slot_reg); |
| 5412 __ Push(slot_reg, name_reg, value_reg); | 5407 __ Push(slot_reg, value_reg); |
| 5413 __ TailCallRuntime(is_strict(language_mode()) | 5408 __ TailCallRuntime(is_strict(language_mode()) |
| 5414 ? Runtime::kStoreGlobalViaContext_Strict | 5409 ? Runtime::kStoreGlobalViaContext_Strict |
| 5415 : Runtime::kStoreGlobalViaContext_Sloppy, | 5410 : Runtime::kStoreGlobalViaContext_Sloppy, |
| 5416 3, 1); | 5411 2, 1); |
| 5417 } | 5412 } |
| 5418 | 5413 |
| 5419 | 5414 |
| 5420 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { | 5415 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { |
| 5421 return ref0.address() - ref1.address(); | 5416 return ref0.address() - ref1.address(); |
| 5422 } | 5417 } |
| 5423 | 5418 |
| 5424 | 5419 |
| 5425 // Calls an API function. Allocates HandleScope, extracts returned value | 5420 // Calls an API function. Allocates HandleScope, extracts returned value |
| 5426 // from handle and propagates exceptions. Restores context. stack_space | 5421 // from handle and propagates exceptions. Restores context. stack_space |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5719 MemOperand(fp, 6 * kPointerSize), NULL); | 5714 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5720 } | 5715 } |
| 5721 | 5716 |
| 5722 | 5717 |
| 5723 #undef __ | 5718 #undef __ |
| 5724 | 5719 |
| 5725 } // namespace internal | 5720 } // namespace internal |
| 5726 } // namespace v8 | 5721 } // namespace v8 |
| 5727 | 5722 |
| 5728 #endif // V8_TARGET_ARCH_MIPS | 5723 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |