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

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

Issue 1237813002: Switch CallConstructStub to take new.target in register. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments about ARM and MIPS. Created 5 years, 5 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/mips64/builtins-mips64.cc ('k') | src/mips64/full-codegen-mips64.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 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_MIPS64 7 #if V8_TARGET_ARCH_MIPS64
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 2762 matching lines...) Expand 10 before | Expand all | Expand 10 after
2773 2773
2774 void CallFunctionStub::Generate(MacroAssembler* masm) { 2774 void CallFunctionStub::Generate(MacroAssembler* masm) {
2775 CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod()); 2775 CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod());
2776 } 2776 }
2777 2777
2778 2778
2779 void CallConstructStub::Generate(MacroAssembler* masm) { 2779 void CallConstructStub::Generate(MacroAssembler* masm) {
2780 // a0 : number of arguments 2780 // a0 : number of arguments
2781 // a1 : the function to call 2781 // a1 : the function to call
2782 // a2 : feedback vector 2782 // a2 : feedback vector
2783 // a3 : (only if a2 is not undefined) slot in feedback vector (Smi) 2783 // a3 : slot in feedback vector (Smi, for RecordCallTarget)
2784 // a4 : original constructor (for IsSuperConstructorCall)
2784 Label slow, non_function_call; 2785 Label slow, non_function_call;
2785 // Check that the function is not a smi. 2786 // Check that the function is not a smi.
2786 __ JumpIfSmi(a1, &non_function_call); 2787 __ JumpIfSmi(a1, &non_function_call);
2787 // Check that the function is a JSFunction. 2788 // Check that the function is a JSFunction.
2788 __ GetObjectType(a1, a4, a4); 2789 __ GetObjectType(a1, a5, a5);
2789 __ Branch(&slow, ne, a4, Operand(JS_FUNCTION_TYPE)); 2790 __ Branch(&slow, ne, a5, Operand(JS_FUNCTION_TYPE));
2790 2791
2791 if (RecordCallTarget()) { 2792 if (RecordCallTarget()) {
2793 if (IsSuperConstructorCall()) {
2794 __ push(a4);
2795 }
2792 GenerateRecordCallTarget(masm); 2796 GenerateRecordCallTarget(masm);
2797 if (IsSuperConstructorCall()) {
2798 __ pop(a4);
2799 }
2793 2800
2794 __ dsrl(at, a3, 32 - kPointerSizeLog2); 2801 __ dsrl(at, a3, 32 - kPointerSizeLog2);
2795 __ Daddu(a5, a2, at); 2802 __ Daddu(a5, a2, at);
2796 if (FLAG_pretenuring_call_new) { 2803 if (FLAG_pretenuring_call_new) {
2797 // Put the AllocationSite from the feedback vector into a2. 2804 // Put the AllocationSite from the feedback vector into a2.
2798 // By adding kPointerSize we encode that we know the AllocationSite 2805 // By adding kPointerSize we encode that we know the AllocationSite
2799 // entry is at the feedback vector slot given by a3 + 1. 2806 // entry is at the feedback vector slot given by a3 + 1.
2800 __ ld(a2, FieldMemOperand(a5, FixedArray::kHeaderSize + kPointerSize)); 2807 __ ld(a2, FieldMemOperand(a5, FixedArray::kHeaderSize + kPointerSize));
2801 } else { 2808 } else {
2802 Label feedback_register_initialized; 2809 Label feedback_register_initialized;
2803 // Put the AllocationSite from the feedback vector into a2, or undefined. 2810 // Put the AllocationSite from the feedback vector into a2, or undefined.
2804 __ ld(a2, FieldMemOperand(a5, FixedArray::kHeaderSize)); 2811 __ ld(a2, FieldMemOperand(a5, FixedArray::kHeaderSize));
2805 __ ld(a5, FieldMemOperand(a2, AllocationSite::kMapOffset)); 2812 __ ld(a5, FieldMemOperand(a2, AllocationSite::kMapOffset));
2806 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); 2813 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex);
2807 __ Branch(&feedback_register_initialized, eq, a5, Operand(at)); 2814 __ Branch(&feedback_register_initialized, eq, a5, Operand(at));
2808 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); 2815 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
2809 __ bind(&feedback_register_initialized); 2816 __ bind(&feedback_register_initialized);
2810 } 2817 }
2811 2818
2812 __ AssertUndefinedOrAllocationSite(a2, a5); 2819 __ AssertUndefinedOrAllocationSite(a2, a5);
2813 } 2820 }
2814 2821
2815 // Pass function as original constructor. 2822 // Pass function as original constructor.
2816 if (IsSuperConstructorCall()) { 2823 if (IsSuperConstructorCall()) {
2817 __ li(a4, Operand(1 * kPointerSize)); 2824 __ mov(a3, a4);
2818 __ dsll(at, a0, kPointerSizeLog2);
2819 __ daddu(a4, a4, at);
2820 __ daddu(at, sp, a4);
2821 __ ld(a3, MemOperand(at, 0));
2822 } else { 2825 } else {
2823 __ mov(a3, a1); 2826 __ mov(a3, a1);
2824 } 2827 }
2825 2828
2826 // Jump to the function-specific construct stub. 2829 // Jump to the function-specific construct stub.
2827 Register jmp_reg = a4; 2830 Register jmp_reg = a4;
2828 __ ld(jmp_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 2831 __ ld(jmp_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
2829 __ ld(jmp_reg, FieldMemOperand(jmp_reg, 2832 __ ld(jmp_reg, FieldMemOperand(jmp_reg,
2830 SharedFunctionInfo::kConstructStubOffset)); 2833 SharedFunctionInfo::kConstructStubOffset));
2831 __ Daddu(at, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); 2834 __ Daddu(at, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag));
2832 __ Jump(at); 2835 __ Jump(at);
2833 2836
2834 // a0: number of arguments 2837 // a0: number of arguments
2835 // a1: called object 2838 // a1: called object
2836 // a4: object type 2839 // a5: object type
2837 Label do_call; 2840 Label do_call;
2838 __ bind(&slow); 2841 __ bind(&slow);
2839 __ Branch(&non_function_call, ne, a4, Operand(JS_FUNCTION_PROXY_TYPE)); 2842 __ Branch(&non_function_call, ne, a5, Operand(JS_FUNCTION_PROXY_TYPE));
2840 __ GetBuiltinFunction(a1, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); 2843 __ GetBuiltinFunction(a1, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR);
2841 __ jmp(&do_call); 2844 __ jmp(&do_call);
2842 2845
2843 __ bind(&non_function_call); 2846 __ bind(&non_function_call);
2844 __ GetBuiltinFunction(a1, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); 2847 __ GetBuiltinFunction(a1, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR);
2845 __ bind(&do_call); 2848 __ bind(&do_call);
2846 // Set expected number of arguments to zero (not changing r0). 2849 // Set expected number of arguments to zero (not changing r0).
2847 __ li(a2, Operand(0, RelocInfo::NONE32)); 2850 __ li(a2, Operand(0, RelocInfo::NONE32));
2848 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 2851 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
2849 RelocInfo::CODE_TARGET); 2852 RelocInfo::CODE_TARGET);
(...skipping 2765 matching lines...) Expand 10 before | Expand all | Expand 10 after
5615 MemOperand(fp, 6 * kPointerSize), NULL); 5618 MemOperand(fp, 6 * kPointerSize), NULL);
5616 } 5619 }
5617 5620
5618 5621
5619 #undef __ 5622 #undef __
5620 5623
5621 } // namespace internal 5624 } // namespace internal
5622 } // namespace v8 5625 } // namespace v8
5623 5626
5624 #endif // V8_TARGET_ARCH_MIPS64 5627 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/builtins-mips64.cc ('k') | src/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698