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 #if V8_TARGET_ARCH_PPC | 5 #if V8_TARGET_ARCH_PPC |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 4248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4259 | 4259 |
4260 __ bind(&need_incremental_pop_scratch); | 4260 __ bind(&need_incremental_pop_scratch); |
4261 __ Pop(regs_.object(), regs_.address()); | 4261 __ Pop(regs_.object(), regs_.address()); |
4262 | 4262 |
4263 __ bind(&need_incremental); | 4263 __ bind(&need_incremental); |
4264 | 4264 |
4265 // Fall through when we need to inform the incremental marker. | 4265 // Fall through when we need to inform the incremental marker. |
4266 } | 4266 } |
4267 | 4267 |
4268 | 4268 |
4269 void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) { | |
4270 // ----------- S t a t e ------------- | |
4271 // -- r3 : element value to store | |
4272 // -- r6 : element index as smi | |
4273 // -- sp[0] : array literal index in function as smi | |
4274 // -- sp[4] : array literal | |
4275 // clobbers r3, r5, r7 | |
4276 // ----------------------------------- | |
4277 | |
4278 Label element_done; | |
4279 Label double_elements; | |
4280 Label smi_element; | |
4281 Label slow_elements; | |
4282 Label fast_elements; | |
4283 | |
4284 // Get array literal index, array literal and its map. | |
4285 __ LoadP(r7, MemOperand(sp, 0 * kPointerSize)); | |
4286 __ LoadP(r4, MemOperand(sp, 1 * kPointerSize)); | |
4287 __ LoadP(r5, FieldMemOperand(r4, JSObject::kMapOffset)); | |
4288 | |
4289 __ CheckFastElements(r5, r8, &double_elements); | |
4290 // FAST_*_SMI_ELEMENTS or FAST_*_ELEMENTS | |
4291 __ JumpIfSmi(r3, &smi_element); | |
4292 __ CheckFastSmiElements(r5, r8, &fast_elements); | |
4293 | |
4294 // Store into the array literal requires a elements transition. Call into | |
4295 // the runtime. | |
4296 __ bind(&slow_elements); | |
4297 // call. | |
4298 __ Push(r4, r6, r3); | |
4299 __ LoadP(r8, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | |
4300 __ LoadP(r8, FieldMemOperand(r8, JSFunction::kLiteralsOffset)); | |
4301 __ Push(r8, r7); | |
4302 __ TailCallRuntime(Runtime::kStoreArrayLiteralElement, 5, 1); | |
4303 | |
4304 // Array literal has ElementsKind of FAST_*_ELEMENTS and value is an object. | |
4305 __ bind(&fast_elements); | |
4306 __ LoadP(r8, FieldMemOperand(r4, JSObject::kElementsOffset)); | |
4307 __ SmiToPtrArrayOffset(r9, r6); | |
4308 __ add(r9, r8, r9); | |
4309 #if V8_TARGET_ARCH_PPC64 | |
4310 // add due to offset alignment requirements of StorePU | |
4311 __ addi(r9, r9, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | |
4312 __ StoreP(r3, MemOperand(r9)); | |
4313 #else | |
4314 __ StorePU(r3, MemOperand(r9, FixedArray::kHeaderSize - kHeapObjectTag)); | |
4315 #endif | |
4316 // Update the write barrier for the array store. | |
4317 __ RecordWrite(r8, r9, r3, kLRHasNotBeenSaved, kDontSaveFPRegs, | |
4318 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | |
4319 __ Ret(); | |
4320 | |
4321 // Array literal has ElementsKind of FAST_*_SMI_ELEMENTS or FAST_*_ELEMENTS, | |
4322 // and value is Smi. | |
4323 __ bind(&smi_element); | |
4324 __ LoadP(r8, FieldMemOperand(r4, JSObject::kElementsOffset)); | |
4325 __ SmiToPtrArrayOffset(r9, r6); | |
4326 __ add(r9, r8, r9); | |
4327 __ StoreP(r3, FieldMemOperand(r9, FixedArray::kHeaderSize), r0); | |
4328 __ Ret(); | |
4329 | |
4330 // Array literal has ElementsKind of FAST_DOUBLE_ELEMENTS. | |
4331 __ bind(&double_elements); | |
4332 __ LoadP(r8, FieldMemOperand(r4, JSObject::kElementsOffset)); | |
4333 __ StoreNumberToDoubleElements(r3, r6, r8, r9, d0, &slow_elements); | |
4334 __ Ret(); | |
4335 } | |
4336 | |
4337 | |
4338 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { | 4269 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { |
4339 CEntryStub ces(isolate(), 1, kSaveFPRegs); | 4270 CEntryStub ces(isolate(), 1, kSaveFPRegs); |
4340 __ Call(ces.GetCode(), RelocInfo::CODE_TARGET); | 4271 __ Call(ces.GetCode(), RelocInfo::CODE_TARGET); |
4341 int parameter_count_offset = | 4272 int parameter_count_offset = |
4342 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; | 4273 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; |
4343 __ LoadP(r4, MemOperand(fp, parameter_count_offset)); | 4274 __ LoadP(r4, MemOperand(fp, parameter_count_offset)); |
4344 if (function_mode() == JS_FUNCTION_STUB_MODE) { | 4275 if (function_mode() == JS_FUNCTION_STUB_MODE) { |
4345 __ addi(r4, r4, Operand(1)); | 4276 __ addi(r4, r4, Operand(1)); |
4346 } | 4277 } |
4347 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 4278 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5723 kStackUnwindSpace, NULL, | 5654 kStackUnwindSpace, NULL, |
5724 MemOperand(fp, 6 * kPointerSize), NULL); | 5655 MemOperand(fp, 6 * kPointerSize), NULL); |
5725 } | 5656 } |
5726 | 5657 |
5727 | 5658 |
5728 #undef __ | 5659 #undef __ |
5729 } // namespace internal | 5660 } // namespace internal |
5730 } // namespace v8 | 5661 } // namespace v8 |
5731 | 5662 |
5732 #endif // V8_TARGET_ARCH_PPC | 5663 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |