| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 7 #if V8_TARGET_ARCH_PPC |
| 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 5299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5310 | 5310 |
| 5311 __ bind(&fast_elements_case); | 5311 __ bind(&fast_elements_case); |
| 5312 GenerateCase(masm, FAST_ELEMENTS); | 5312 GenerateCase(masm, FAST_ELEMENTS); |
| 5313 } | 5313 } |
| 5314 | 5314 |
| 5315 | 5315 |
| 5316 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) { | 5316 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) { |
| 5317 Register context = cp; | 5317 Register context = cp; |
| 5318 Register result = r3; | 5318 Register result = r3; |
| 5319 Register slot = r5; | 5319 Register slot = r5; |
| 5320 Register name = r6; | |
| 5321 Label slow_case; | |
| 5322 | 5320 |
| 5323 // Go up the context chain to the script context. | 5321 // Go up the context chain to the script context. |
| 5324 for (int i = 0; i < depth(); ++i) { | 5322 for (int i = 0; i < depth(); ++i) { |
| 5325 __ LoadP(result, ContextOperand(context, Context::PREVIOUS_INDEX)); | 5323 __ LoadP(result, ContextOperand(context, Context::PREVIOUS_INDEX)); |
| 5326 context = result; | 5324 context = result; |
| 5327 } | 5325 } |
| 5328 | 5326 |
| 5329 // Load the PropertyCell value at the specified slot. | 5327 // Load the PropertyCell value at the specified slot. |
| 5330 __ ShiftLeftImm(r0, slot, Operand(kPointerSizeLog2)); | 5328 __ ShiftLeftImm(r0, slot, Operand(kPointerSizeLog2)); |
| 5331 __ add(result, context, r0); | 5329 __ add(result, context, r0); |
| 5332 __ LoadP(result, ContextOperand(result)); | 5330 __ LoadP(result, ContextOperand(result)); |
| 5333 __ LoadP(result, FieldMemOperand(result, PropertyCell::kValueOffset)); | 5331 __ LoadP(result, FieldMemOperand(result, PropertyCell::kValueOffset)); |
| 5334 | 5332 |
| 5335 // If the result is not the_hole, return. Otherwise, handle in the runtime. | 5333 // If the result is not the_hole, return. Otherwise, handle in the runtime. |
| 5336 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); | 5334 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); |
| 5337 __ Ret(ne); | 5335 __ Ret(ne); |
| 5338 | 5336 |
| 5339 // Fallback to runtime. | 5337 // Fallback to runtime. |
| 5340 __ bind(&slow_case); | |
| 5341 __ SmiTag(slot); | 5338 __ SmiTag(slot); |
| 5342 __ Push(slot, name); | 5339 __ Push(slot); |
| 5343 __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 2, 1); | 5340 __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 1, 1); |
| 5344 } | 5341 } |
| 5345 | 5342 |
| 5346 | 5343 |
| 5347 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { | 5344 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { |
| 5348 Register value = r3; | 5345 Register value = r3; |
| 5349 Register slot = r5; | 5346 Register slot = r5; |
| 5350 Register name = r6; | |
| 5351 | 5347 |
| 5352 Register cell = r4; | 5348 Register cell = r4; |
| 5353 Register cell_details = r7; | 5349 Register cell_details = r6; |
| 5354 Register cell_value = r8; | 5350 Register cell_value = r7; |
| 5355 Register cell_value_map = r9; | 5351 Register cell_value_map = r8; |
| 5356 Register scratch = r10; | 5352 Register scratch = r9; |
| 5357 | 5353 |
| 5358 Register context = cp; | 5354 Register context = cp; |
| 5359 Register context_temp = cell; | 5355 Register context_temp = cell; |
| 5360 | 5356 |
| 5361 Label fast_heapobject_case, fast_smi_case, slow_case; | 5357 Label fast_heapobject_case, fast_smi_case, slow_case; |
| 5362 | 5358 |
| 5363 if (FLAG_debug_code) { | 5359 if (FLAG_debug_code) { |
| 5364 __ CompareRoot(value, Heap::kTheHoleValueRootIndex); | 5360 __ CompareRoot(value, Heap::kTheHoleValueRootIndex); |
| 5365 __ Check(ne, kUnexpectedValue); | 5361 __ Check(ne, kUnexpectedValue); |
| 5366 __ AssertName(name); | |
| 5367 } | 5362 } |
| 5368 | 5363 |
| 5369 // Go up the context chain to the script context. | 5364 // Go up the context chain to the script context. |
| 5370 for (int i = 0; i < depth(); i++) { | 5365 for (int i = 0; i < depth(); i++) { |
| 5371 __ LoadP(context_temp, ContextOperand(context, Context::PREVIOUS_INDEX)); | 5366 __ LoadP(context_temp, ContextOperand(context, Context::PREVIOUS_INDEX)); |
| 5372 context = context_temp; | 5367 context = context_temp; |
| 5373 } | 5368 } |
| 5374 | 5369 |
| 5375 // Load the PropertyCell at the specified slot. | 5370 // Load the PropertyCell at the specified slot. |
| 5376 __ ShiftLeftImm(r0, slot, Operand(kPointerSizeLog2)); | 5371 __ ShiftLeftImm(r0, slot, Operand(kPointerSizeLog2)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 5390 __ cmpi(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode( | 5385 __ cmpi(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode( |
| 5391 PropertyCellType::kMutable) | | 5386 PropertyCellType::kMutable) | |
| 5392 PropertyDetails::KindField::encode(kData))); | 5387 PropertyDetails::KindField::encode(kData))); |
| 5393 __ bne(¬_mutable_data); | 5388 __ bne(¬_mutable_data); |
| 5394 __ JumpIfSmi(value, &fast_smi_case); | 5389 __ JumpIfSmi(value, &fast_smi_case); |
| 5395 | 5390 |
| 5396 __ bind(&fast_heapobject_case); | 5391 __ bind(&fast_heapobject_case); |
| 5397 __ StoreP(value, FieldMemOperand(cell, PropertyCell::kValueOffset), r0); | 5392 __ StoreP(value, FieldMemOperand(cell, PropertyCell::kValueOffset), r0); |
| 5398 // RecordWriteField clobbers the value register, so we copy it before the | 5393 // RecordWriteField clobbers the value register, so we copy it before the |
| 5399 // call. | 5394 // call. |
| 5400 __ mr(r7, value); | 5395 __ mr(r6, value); |
| 5401 __ RecordWriteField(cell, PropertyCell::kValueOffset, r7, scratch, | 5396 __ RecordWriteField(cell, PropertyCell::kValueOffset, r6, scratch, |
| 5402 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, | 5397 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, |
| 5403 OMIT_SMI_CHECK); | 5398 OMIT_SMI_CHECK); |
| 5404 __ Ret(); | 5399 __ Ret(); |
| 5405 | 5400 |
| 5406 __ bind(¬_mutable_data); | 5401 __ bind(¬_mutable_data); |
| 5407 // Check if PropertyCell value matches the new value (relevant for Constant, | 5402 // Check if PropertyCell value matches the new value (relevant for Constant, |
| 5408 // ConstantType and Undefined cells). | 5403 // ConstantType and Undefined cells). |
| 5409 Label not_same_value; | 5404 Label not_same_value; |
| 5410 __ LoadP(cell_value, FieldMemOperand(cell, PropertyCell::kValueOffset)); | 5405 __ LoadP(cell_value, FieldMemOperand(cell, PropertyCell::kValueOffset)); |
| 5411 __ cmp(cell_value, value); | 5406 __ cmp(cell_value, value); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5460 __ JumpIfSmi(cell_value, &slow_case); | 5455 __ JumpIfSmi(cell_value, &slow_case); |
| 5461 | 5456 |
| 5462 __ LoadP(cell_value_map, FieldMemOperand(cell_value, HeapObject::kMapOffset)); | 5457 __ LoadP(cell_value_map, FieldMemOperand(cell_value, HeapObject::kMapOffset)); |
| 5463 __ LoadP(scratch, FieldMemOperand(value, HeapObject::kMapOffset)); | 5458 __ LoadP(scratch, FieldMemOperand(value, HeapObject::kMapOffset)); |
| 5464 __ cmp(cell_value_map, scratch); | 5459 __ cmp(cell_value_map, scratch); |
| 5465 __ beq(&fast_heapobject_case); | 5460 __ beq(&fast_heapobject_case); |
| 5466 | 5461 |
| 5467 // Fallback to runtime. | 5462 // Fallback to runtime. |
| 5468 __ bind(&slow_case); | 5463 __ bind(&slow_case); |
| 5469 __ SmiTag(slot); | 5464 __ SmiTag(slot); |
| 5470 __ Push(slot, name, value); | 5465 __ Push(slot, value); |
| 5471 __ TailCallRuntime(is_strict(language_mode()) | 5466 __ TailCallRuntime(is_strict(language_mode()) |
| 5472 ? Runtime::kStoreGlobalViaContext_Strict | 5467 ? Runtime::kStoreGlobalViaContext_Strict |
| 5473 : Runtime::kStoreGlobalViaContext_Sloppy, | 5468 : Runtime::kStoreGlobalViaContext_Sloppy, |
| 5474 3, 1); | 5469 2, 1); |
| 5475 } | 5470 } |
| 5476 | 5471 |
| 5477 | 5472 |
| 5478 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { | 5473 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { |
| 5479 return ref0.address() - ref1.address(); | 5474 return ref0.address() - ref1.address(); |
| 5480 } | 5475 } |
| 5481 | 5476 |
| 5482 | 5477 |
| 5483 // Calls an API function. Allocates HandleScope, extracts returned value | 5478 // Calls an API function. Allocates HandleScope, extracts returned value |
| 5484 // from handle and propagates exceptions. Restores context. stack_space | 5479 // from handle and propagates exceptions. Restores context. stack_space |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5832 kStackUnwindSpace, NULL, | 5827 kStackUnwindSpace, NULL, |
| 5833 MemOperand(fp, 6 * kPointerSize), NULL); | 5828 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5834 } | 5829 } |
| 5835 | 5830 |
| 5836 | 5831 |
| 5837 #undef __ | 5832 #undef __ |
| 5838 } // namespace internal | 5833 } // namespace internal |
| 5839 } // namespace v8 | 5834 } // namespace v8 |
| 5840 | 5835 |
| 5841 #endif // V8_TARGET_ARCH_PPC | 5836 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |