| 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 2625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2636 CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod()); | 2636 CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod()); |
| 2637 } | 2637 } |
| 2638 | 2638 |
| 2639 | 2639 |
| 2640 void CallConstructStub::Generate(MacroAssembler* masm) { | 2640 void CallConstructStub::Generate(MacroAssembler* masm) { |
| 2641 // r3 : number of arguments | 2641 // r3 : number of arguments |
| 2642 // r4 : the function to call | 2642 // r4 : the function to call |
| 2643 // r5 : feedback vector | 2643 // r5 : feedback vector |
| 2644 // r6 : slot in feedback vector (Smi, for RecordCallTarget) | 2644 // r6 : slot in feedback vector (Smi, for RecordCallTarget) |
| 2645 // r7 : original constructor (for IsSuperConstructorCall) | 2645 // r7 : original constructor (for IsSuperConstructorCall) |
| 2646 Label slow, non_function_call; | |
| 2647 | 2646 |
| 2647 Label non_function; |
| 2648 // Check that the function is not a smi. | 2648 // Check that the function is not a smi. |
| 2649 __ JumpIfSmi(r4, &non_function_call); | 2649 __ JumpIfSmi(r4, &non_function); |
| 2650 // Check that the function is a JSFunction. | 2650 // Check that the function is a JSFunction. |
| 2651 __ CompareObjectType(r4, r8, r8, JS_FUNCTION_TYPE); | 2651 __ CompareObjectType(r4, r8, r8, JS_FUNCTION_TYPE); |
| 2652 __ bne(&slow); | 2652 __ bne(&non_function); |
| 2653 | 2653 |
| 2654 if (RecordCallTarget()) { | 2654 if (RecordCallTarget()) { |
| 2655 GenerateRecordCallTarget(masm, IsSuperConstructorCall()); | 2655 GenerateRecordCallTarget(masm, IsSuperConstructorCall()); |
| 2656 | 2656 |
| 2657 __ SmiToPtrArrayOffset(r8, r6); | 2657 __ SmiToPtrArrayOffset(r8, r6); |
| 2658 __ add(r8, r5, r8); | 2658 __ add(r8, r5, r8); |
| 2659 // Put the AllocationSite from the feedback vector into r5, or undefined. | 2659 // Put the AllocationSite from the feedback vector into r5, or undefined. |
| 2660 __ LoadP(r5, FieldMemOperand(r8, FixedArray::kHeaderSize)); | 2660 __ LoadP(r5, FieldMemOperand(r8, FixedArray::kHeaderSize)); |
| 2661 __ LoadP(r8, FieldMemOperand(r5, AllocationSite::kMapOffset)); | 2661 __ LoadP(r8, FieldMemOperand(r5, AllocationSite::kMapOffset)); |
| 2662 __ CompareRoot(r8, Heap::kAllocationSiteMapRootIndex); | 2662 __ CompareRoot(r8, Heap::kAllocationSiteMapRootIndex); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2673 __ AssertUndefinedOrAllocationSite(r5, r8); | 2673 __ AssertUndefinedOrAllocationSite(r5, r8); |
| 2674 } | 2674 } |
| 2675 | 2675 |
| 2676 // Pass function as original constructor. | 2676 // Pass function as original constructor. |
| 2677 if (IsSuperConstructorCall()) { | 2677 if (IsSuperConstructorCall()) { |
| 2678 __ mr(r6, r7); | 2678 __ mr(r6, r7); |
| 2679 } else { | 2679 } else { |
| 2680 __ mr(r6, r4); | 2680 __ mr(r6, r4); |
| 2681 } | 2681 } |
| 2682 | 2682 |
| 2683 // Jump to the function-specific construct stub. | 2683 // Tail call to the function-specific construct stub (still in the caller |
| 2684 Register jmp_reg = r7; | 2684 // context at this point). |
| 2685 __ LoadP(jmp_reg, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); | 2685 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
| 2686 __ LoadP(jmp_reg, | 2686 __ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kConstructStubOffset)); |
| 2687 FieldMemOperand(jmp_reg, SharedFunctionInfo::kConstructStubOffset)); | 2687 __ addi(ip, r7, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 2688 __ addi(ip, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); | |
| 2689 __ JumpToJSEntry(ip); | 2688 __ JumpToJSEntry(ip); |
| 2690 | 2689 |
| 2691 // r3: number of arguments | 2690 __ bind(&non_function); |
| 2692 // r4: called object | 2691 __ mr(r6, r4); |
| 2693 // r8: object type | 2692 __ Jump(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
| 2694 __ bind(&slow); | |
| 2695 { | |
| 2696 STATIC_ASSERT(JS_FUNCTION_PROXY_TYPE < 0xffffu); | |
| 2697 __ cmpi(r8, Operand(JS_FUNCTION_PROXY_TYPE)); | |
| 2698 __ bne(&non_function_call); | |
| 2699 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. | |
| 2700 __ LoadP(r4, FieldMemOperand(r4, JSFunctionProxy::kConstructTrapOffset)); | |
| 2701 __ Jump(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | |
| 2702 | |
| 2703 __ bind(&non_function_call); | |
| 2704 { | |
| 2705 // Determine the delegate for the target (if any). | |
| 2706 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | |
| 2707 __ SmiTag(r3); | |
| 2708 __ Push(r3, r4); | |
| 2709 __ CallRuntime(Runtime::kGetConstructorDelegate, 1); | |
| 2710 __ mr(r4, r3); | |
| 2711 __ pop(r3); | |
| 2712 __ SmiUntag(r3); | |
| 2713 } | |
| 2714 // The delegate is always a regular function. | |
| 2715 __ AssertFunction(r4); | |
| 2716 __ Jump(masm->isolate()->builtins()->CallFunction(), | |
| 2717 RelocInfo::CODE_TARGET); | |
| 2718 } | |
| 2719 } | 2693 } |
| 2720 | 2694 |
| 2721 | 2695 |
| 2722 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { | 2696 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { |
| 2723 __ LoadP(vector, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 2697 __ LoadP(vector, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 2724 __ LoadP(vector, | 2698 __ LoadP(vector, |
| 2725 FieldMemOperand(vector, JSFunction::kSharedFunctionInfoOffset)); | 2699 FieldMemOperand(vector, JSFunction::kSharedFunctionInfoOffset)); |
| 2726 __ LoadP(vector, | 2700 __ LoadP(vector, |
| 2727 FieldMemOperand(vector, SharedFunctionInfo::kFeedbackVectorOffset)); | 2701 FieldMemOperand(vector, SharedFunctionInfo::kFeedbackVectorOffset)); |
| 2728 } | 2702 } |
| (...skipping 3109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5838 kStackUnwindSpace, NULL, | 5812 kStackUnwindSpace, NULL, |
| 5839 MemOperand(fp, 6 * kPointerSize), NULL); | 5813 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5840 } | 5814 } |
| 5841 | 5815 |
| 5842 | 5816 |
| 5843 #undef __ | 5817 #undef __ |
| 5844 } // namespace internal | 5818 } // namespace internal |
| 5845 } // namespace v8 | 5819 } // namespace v8 |
| 5846 | 5820 |
| 5847 #endif // V8_TARGET_ARCH_PPC | 5821 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |