Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: src/ppc/code-stubs-ppc.cc

Issue 2601243003: PPC/s390: [stubs] Port FastNewObjectStub to TF (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/builtins/s390/builtins-s390.cc ('k') | src/ppc/interface-descriptors-ppc.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/api-arguments.h" 8 #include "src/api-arguments.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 3504 matching lines...) Expand 10 before | Expand all | Expand 10 after
3515 3515
3516 Label fast_elements_case; 3516 Label fast_elements_case;
3517 __ cmpi(r6, Operand(FAST_ELEMENTS)); 3517 __ cmpi(r6, Operand(FAST_ELEMENTS));
3518 __ beq(&fast_elements_case); 3518 __ beq(&fast_elements_case);
3519 GenerateCase(masm, FAST_HOLEY_ELEMENTS); 3519 GenerateCase(masm, FAST_HOLEY_ELEMENTS);
3520 3520
3521 __ bind(&fast_elements_case); 3521 __ bind(&fast_elements_case);
3522 GenerateCase(masm, FAST_ELEMENTS); 3522 GenerateCase(masm, FAST_ELEMENTS);
3523 } 3523 }
3524 3524
3525 void FastNewObjectStub::Generate(MacroAssembler* masm) {
3526 // ----------- S t a t e -------------
3527 // -- r4 : target
3528 // -- r6 : new target
3529 // -- cp : context
3530 // -- lr : return address
3531 // -----------------------------------
3532 __ AssertFunction(r4);
3533 __ AssertReceiver(r6);
3534
3535 // Verify that the new target is a JSFunction.
3536 Label new_object;
3537 __ CompareObjectType(r6, r5, r5, JS_FUNCTION_TYPE);
3538 __ bne(&new_object);
3539
3540 // Load the initial map and verify that it's in fact a map.
3541 __ LoadP(r5, FieldMemOperand(r6, JSFunction::kPrototypeOrInitialMapOffset));
3542 __ JumpIfSmi(r5, &new_object);
3543 __ CompareObjectType(r5, r3, r3, MAP_TYPE);
3544 __ bne(&new_object);
3545
3546 // Fall back to runtime if the target differs from the new target's
3547 // initial map constructor.
3548 __ LoadP(r3, FieldMemOperand(r5, Map::kConstructorOrBackPointerOffset));
3549 __ cmp(r3, r4);
3550 __ bne(&new_object);
3551
3552 // Allocate the JSObject on the heap.
3553 Label allocate, done_allocate;
3554 __ lbz(r7, FieldMemOperand(r5, Map::kInstanceSizeOffset));
3555 __ Allocate(r7, r3, r8, r9, &allocate, SIZE_IN_WORDS);
3556 __ bind(&done_allocate);
3557
3558 // Initialize the JSObject fields.
3559 __ StoreP(r5, FieldMemOperand(r3, JSObject::kMapOffset), r0);
3560 __ LoadRoot(r6, Heap::kEmptyFixedArrayRootIndex);
3561 __ StoreP(r6, FieldMemOperand(r3, JSObject::kPropertiesOffset), r0);
3562 __ StoreP(r6, FieldMemOperand(r3, JSObject::kElementsOffset), r0);
3563 STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize);
3564 __ addi(r4, r3, Operand(JSObject::kHeaderSize - kHeapObjectTag));
3565
3566 // ----------- S t a t e -------------
3567 // -- r3 : result (tagged)
3568 // -- r4 : result fields (untagged)
3569 // -- r8 : result end (untagged)
3570 // -- r5 : initial map
3571 // -- cp : context
3572 // -- lr : return address
3573 // -----------------------------------
3574
3575 // Perform in-object slack tracking if requested.
3576 Label slack_tracking;
3577 STATIC_ASSERT(Map::kNoSlackTracking == 0);
3578 __ LoadRoot(r9, Heap::kUndefinedValueRootIndex);
3579 __ lwz(r6, FieldMemOperand(r5, Map::kBitField3Offset));
3580 __ DecodeField<Map::ConstructionCounter>(r10, r6, SetRC);
3581 __ bne(&slack_tracking, cr0);
3582 {
3583 // Initialize all in-object fields with undefined.
3584 __ InitializeFieldsWithFiller(r4, r8, r9);
3585 __ Ret();
3586 }
3587 __ bind(&slack_tracking);
3588 {
3589 // Decrease generous allocation count.
3590 STATIC_ASSERT(Map::ConstructionCounter::kNext == 32);
3591 __ Add(r6, r6, -(1 << Map::ConstructionCounter::kShift), r0);
3592 __ stw(r6, FieldMemOperand(r5, Map::kBitField3Offset));
3593
3594 // Initialize the in-object fields with undefined.
3595 __ lbz(r7, FieldMemOperand(r5, Map::kUnusedPropertyFieldsOffset));
3596 __ ShiftLeftImm(r7, r7, Operand(kPointerSizeLog2));
3597 __ sub(r7, r8, r7);
3598 __ InitializeFieldsWithFiller(r4, r7, r9);
3599
3600 // Initialize the remaining (reserved) fields with one pointer filler map.
3601 __ LoadRoot(r9, Heap::kOnePointerFillerMapRootIndex);
3602 __ InitializeFieldsWithFiller(r4, r8, r9);
3603
3604 // Check if we can finalize the instance size.
3605 __ cmpi(r10, Operand(Map::kSlackTrackingCounterEnd));
3606 __ Ret(ne);
3607
3608 // Finalize the instance size.
3609 {
3610 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
3611 __ Push(r3, r5);
3612 __ CallRuntime(Runtime::kFinalizeInstanceSize);
3613 __ Pop(r3);
3614 }
3615 __ Ret();
3616 }
3617
3618 // Fall back to %AllocateInNewSpace.
3619 __ bind(&allocate);
3620 {
3621 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
3622 STATIC_ASSERT(kSmiTag == 0);
3623 __ ShiftLeftImm(r7, r7,
3624 Operand(kPointerSizeLog2 + kSmiTagSize + kSmiShiftSize));
3625 __ Push(r5, r7);
3626 __ CallRuntime(Runtime::kAllocateInNewSpace);
3627 __ Pop(r5);
3628 }
3629 __ lbz(r8, FieldMemOperand(r5, Map::kInstanceSizeOffset));
3630 __ ShiftLeftImm(r8, r8, Operand(kPointerSizeLog2));
3631 __ add(r8, r3, r8);
3632 __ subi(r8, r8, Operand(kHeapObjectTag));
3633 __ b(&done_allocate);
3634
3635 // Fall back to %NewObject.
3636 __ bind(&new_object);
3637 __ Push(r4, r6);
3638 __ TailCallRuntime(Runtime::kNewObject);
3639 }
3640
3641 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { 3525 void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
3642 // ----------- S t a t e ------------- 3526 // ----------- S t a t e -------------
3643 // -- r4 : function 3527 // -- r4 : function
3644 // -- cp : context 3528 // -- cp : context
3645 // -- fp : frame pointer 3529 // -- fp : frame pointer
3646 // -- lr : return address 3530 // -- lr : return address
3647 // ----------------------------------- 3531 // -----------------------------------
3648 __ AssertFunction(r4); 3532 __ AssertFunction(r4);
3649 3533
3650 // Make r5 point to the JavaScript frame. 3534 // Make r5 point to the JavaScript frame.
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
4535 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); 4419 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize);
4536 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 4420 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
4537 kStackUnwindSpace, NULL, return_value_operand, NULL); 4421 kStackUnwindSpace, NULL, return_value_operand, NULL);
4538 } 4422 }
4539 4423
4540 #undef __ 4424 #undef __
4541 } // namespace internal 4425 } // namespace internal
4542 } // namespace v8 4426 } // namespace v8
4543 4427
4544 #endif // V8_TARGET_ARCH_PPC 4428 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/builtins/s390/builtins-s390.cc ('k') | src/ppc/interface-descriptors-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698