| 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 #if V8_TARGET_ARCH_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
| 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/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 3549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3560 } | 3560 } |
| 3561 | 3561 |
| 3562 Label fast_elements_case; | 3562 Label fast_elements_case; |
| 3563 __ Branch(&fast_elements_case, eq, a3, Operand(FAST_ELEMENTS)); | 3563 __ Branch(&fast_elements_case, eq, a3, Operand(FAST_ELEMENTS)); |
| 3564 GenerateCase(masm, FAST_HOLEY_ELEMENTS); | 3564 GenerateCase(masm, FAST_HOLEY_ELEMENTS); |
| 3565 | 3565 |
| 3566 __ bind(&fast_elements_case); | 3566 __ bind(&fast_elements_case); |
| 3567 GenerateCase(masm, FAST_ELEMENTS); | 3567 GenerateCase(masm, FAST_ELEMENTS); |
| 3568 } | 3568 } |
| 3569 | 3569 |
| 3570 | |
| 3571 void FastNewObjectStub::Generate(MacroAssembler* masm) { | |
| 3572 // ----------- S t a t e ------------- | |
| 3573 // -- a1 : target | |
| 3574 // -- a3 : new target | |
| 3575 // -- cp : context | |
| 3576 // -- ra : return address | |
| 3577 // ----------------------------------- | |
| 3578 __ AssertFunction(a1); | |
| 3579 __ AssertReceiver(a3); | |
| 3580 | |
| 3581 // Verify that the new target is a JSFunction. | |
| 3582 Label new_object; | |
| 3583 __ GetObjectType(a3, a2, a2); | |
| 3584 __ Branch(&new_object, ne, a2, Operand(JS_FUNCTION_TYPE)); | |
| 3585 | |
| 3586 // Load the initial map and verify that it's in fact a map. | |
| 3587 __ ld(a2, FieldMemOperand(a3, JSFunction::kPrototypeOrInitialMapOffset)); | |
| 3588 __ JumpIfSmi(a2, &new_object); | |
| 3589 __ GetObjectType(a2, a0, a0); | |
| 3590 __ Branch(&new_object, ne, a0, Operand(MAP_TYPE)); | |
| 3591 | |
| 3592 // Fall back to runtime if the target differs from the new target's | |
| 3593 // initial map constructor. | |
| 3594 __ ld(a0, FieldMemOperand(a2, Map::kConstructorOrBackPointerOffset)); | |
| 3595 __ Branch(&new_object, ne, a0, Operand(a1)); | |
| 3596 | |
| 3597 // Allocate the JSObject on the heap. | |
| 3598 Label allocate, done_allocate; | |
| 3599 __ lbu(a4, FieldMemOperand(a2, Map::kInstanceSizeOffset)); | |
| 3600 __ Allocate(a4, v0, a5, a0, &allocate, SIZE_IN_WORDS); | |
| 3601 __ bind(&done_allocate); | |
| 3602 | |
| 3603 // Initialize the JSObject fields. | |
| 3604 __ sd(a2, FieldMemOperand(v0, JSObject::kMapOffset)); | |
| 3605 __ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex); | |
| 3606 __ sd(a3, FieldMemOperand(v0, JSObject::kPropertiesOffset)); | |
| 3607 __ sd(a3, FieldMemOperand(v0, JSObject::kElementsOffset)); | |
| 3608 STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); | |
| 3609 __ Daddu(a1, v0, Operand(JSObject::kHeaderSize - kHeapObjectTag)); | |
| 3610 | |
| 3611 // ----------- S t a t e ------------- | |
| 3612 // -- v0 : result (tagged) | |
| 3613 // -- a1 : result fields (untagged) | |
| 3614 // -- a5 : result end (untagged) | |
| 3615 // -- a2 : initial map | |
| 3616 // -- cp : context | |
| 3617 // -- ra : return address | |
| 3618 // ----------------------------------- | |
| 3619 | |
| 3620 // Perform in-object slack tracking if requested. | |
| 3621 Label slack_tracking; | |
| 3622 STATIC_ASSERT(Map::kNoSlackTracking == 0); | |
| 3623 __ lwu(a3, FieldMemOperand(a2, Map::kBitField3Offset)); | |
| 3624 __ And(at, a3, Operand(Map::ConstructionCounter::kMask)); | |
| 3625 __ Branch(USE_DELAY_SLOT, &slack_tracking, ne, at, Operand(zero_reg)); | |
| 3626 __ LoadRoot(a0, Heap::kUndefinedValueRootIndex); // In delay slot. | |
| 3627 { | |
| 3628 // Initialize all in-object fields with undefined. | |
| 3629 __ InitializeFieldsWithFiller(a1, a5, a0); | |
| 3630 __ Ret(); | |
| 3631 } | |
| 3632 __ bind(&slack_tracking); | |
| 3633 { | |
| 3634 // Decrease generous allocation count. | |
| 3635 STATIC_ASSERT(Map::ConstructionCounter::kNext == 32); | |
| 3636 __ Subu(a3, a3, Operand(1 << Map::ConstructionCounter::kShift)); | |
| 3637 __ sw(a3, FieldMemOperand(a2, Map::kBitField3Offset)); | |
| 3638 | |
| 3639 // Initialize the in-object fields with undefined. | |
| 3640 __ lbu(a4, FieldMemOperand(a2, Map::kUnusedPropertyFieldsOffset)); | |
| 3641 __ dsll(a4, a4, kPointerSizeLog2); | |
| 3642 __ Dsubu(a4, a5, a4); | |
| 3643 __ InitializeFieldsWithFiller(a1, a4, a0); | |
| 3644 | |
| 3645 // Initialize the remaining (reserved) fields with one pointer filler map. | |
| 3646 __ LoadRoot(a0, Heap::kOnePointerFillerMapRootIndex); | |
| 3647 __ InitializeFieldsWithFiller(a1, a5, a0); | |
| 3648 | |
| 3649 // Check if we can finalize the instance size. | |
| 3650 Label finalize; | |
| 3651 STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1); | |
| 3652 __ And(a3, a3, Operand(Map::ConstructionCounter::kMask)); | |
| 3653 __ Branch(&finalize, eq, a3, Operand(zero_reg)); | |
| 3654 __ Ret(); | |
| 3655 | |
| 3656 // Finalize the instance size. | |
| 3657 __ bind(&finalize); | |
| 3658 { | |
| 3659 FrameScope scope(masm, StackFrame::INTERNAL); | |
| 3660 __ Push(v0, a2); | |
| 3661 __ CallRuntime(Runtime::kFinalizeInstanceSize); | |
| 3662 __ Pop(v0); | |
| 3663 } | |
| 3664 __ Ret(); | |
| 3665 } | |
| 3666 | |
| 3667 // Fall back to %AllocateInNewSpace. | |
| 3668 __ bind(&allocate); | |
| 3669 { | |
| 3670 FrameScope scope(masm, StackFrame::INTERNAL); | |
| 3671 STATIC_ASSERT(kSmiTag == 0); | |
| 3672 STATIC_ASSERT(kSmiTagSize == 1); | |
| 3673 __ dsll(a4, a4, kPointerSizeLog2 + kSmiShiftSize + kSmiTagSize); | |
| 3674 __ SmiTag(a4); | |
| 3675 __ Push(a2, a4); | |
| 3676 __ CallRuntime(Runtime::kAllocateInNewSpace); | |
| 3677 __ Pop(a2); | |
| 3678 } | |
| 3679 __ lbu(a5, FieldMemOperand(a2, Map::kInstanceSizeOffset)); | |
| 3680 __ Dlsa(a5, v0, a5, kPointerSizeLog2); | |
| 3681 STATIC_ASSERT(kHeapObjectTag == 1); | |
| 3682 __ Dsubu(a5, a5, Operand(kHeapObjectTag)); | |
| 3683 __ jmp(&done_allocate); | |
| 3684 | |
| 3685 // Fall back to %NewObject. | |
| 3686 __ bind(&new_object); | |
| 3687 __ Push(a1, a3); | |
| 3688 __ TailCallRuntime(Runtime::kNewObject); | |
| 3689 } | |
| 3690 | |
| 3691 | |
| 3692 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { | 3570 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { |
| 3693 // ----------- S t a t e ------------- | 3571 // ----------- S t a t e ------------- |
| 3694 // -- a1 : function | 3572 // -- a1 : function |
| 3695 // -- cp : context | 3573 // -- cp : context |
| 3696 // -- fp : frame pointer | 3574 // -- fp : frame pointer |
| 3697 // -- ra : return address | 3575 // -- ra : return address |
| 3698 // ----------------------------------- | 3576 // ----------------------------------- |
| 3699 __ AssertFunction(a1); | 3577 __ AssertFunction(a1); |
| 3700 | 3578 |
| 3701 // Make a2 point to the JavaScript frame. | 3579 // Make a2 point to the JavaScript frame. |
| (...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4508 kStackUnwindSpace, kInvalidStackOffset, | 4386 kStackUnwindSpace, kInvalidStackOffset, |
| 4509 return_value_operand, NULL); | 4387 return_value_operand, NULL); |
| 4510 } | 4388 } |
| 4511 | 4389 |
| 4512 #undef __ | 4390 #undef __ |
| 4513 | 4391 |
| 4514 } // namespace internal | 4392 } // namespace internal |
| 4515 } // namespace v8 | 4393 } // namespace v8 |
| 4516 | 4394 |
| 4517 #endif // V8_TARGET_ARCH_MIPS64 | 4395 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |