| 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/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
| (...skipping 2544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2555 | 2555 |
| 2556 __ lbu(a4, FieldMemOperand(a3, SharedFunctionInfo::kStrictModeByteOffset)); | 2556 __ lbu(a4, FieldMemOperand(a3, SharedFunctionInfo::kStrictModeByteOffset)); |
| 2557 __ And(at, a4, Operand(strict_mode_function_mask)); | 2557 __ And(at, a4, Operand(strict_mode_function_mask)); |
| 2558 __ Branch(cont, ne, at, Operand(zero_reg)); | 2558 __ Branch(cont, ne, at, Operand(zero_reg)); |
| 2559 __ lbu(a4, FieldMemOperand(a3, SharedFunctionInfo::kNativeByteOffset)); | 2559 __ lbu(a4, FieldMemOperand(a3, SharedFunctionInfo::kNativeByteOffset)); |
| 2560 __ And(at, a4, Operand(native_mask)); | 2560 __ And(at, a4, Operand(native_mask)); |
| 2561 __ Branch(cont, ne, at, Operand(zero_reg)); | 2561 __ Branch(cont, ne, at, Operand(zero_reg)); |
| 2562 } | 2562 } |
| 2563 | 2563 |
| 2564 | 2564 |
| 2565 static void EmitSlowCase(MacroAssembler* masm, | 2565 static void EmitSlowCase(MacroAssembler* masm, int argc) { |
| 2566 int argc, | 2566 __ li(a0, Operand(argc)); |
| 2567 Label* non_function) { | 2567 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 2568 // Check for function proxy. | |
| 2569 __ Branch(non_function, ne, a4, Operand(JS_FUNCTION_PROXY_TYPE)); | |
| 2570 __ push(a1); // put proxy as additional argument | |
| 2571 __ li(a0, Operand(argc + 1, RelocInfo::NONE32)); | |
| 2572 __ mov(a2, zero_reg); | |
| 2573 __ GetBuiltinFunction(a1, Context::CALL_FUNCTION_PROXY_BUILTIN_INDEX); | |
| 2574 { | |
| 2575 Handle<Code> adaptor = | |
| 2576 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); | |
| 2577 __ Jump(adaptor, RelocInfo::CODE_TARGET); | |
| 2578 } | |
| 2579 | |
| 2580 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead | |
| 2581 // of the original receiver from the call site). | |
| 2582 __ bind(non_function); | |
| 2583 __ sd(a1, MemOperand(sp, argc * kPointerSize)); | |
| 2584 __ li(a0, Operand(argc)); // Set up the number of arguments. | |
| 2585 __ mov(a2, zero_reg); | |
| 2586 __ GetBuiltinFunction(a1, Context::CALL_NON_FUNCTION_BUILTIN_INDEX); | |
| 2587 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | |
| 2588 RelocInfo::CODE_TARGET); | |
| 2589 } | 2568 } |
| 2590 | 2569 |
| 2591 | 2570 |
| 2592 static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) { | 2571 static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) { |
| 2593 // Wrap the receiver and patch it back onto the stack. | 2572 // Wrap the receiver and patch it back onto the stack. |
| 2594 { FrameScope frame_scope(masm, StackFrame::INTERNAL); | 2573 { FrameScope frame_scope(masm, StackFrame::INTERNAL); |
| 2595 __ Push(a1); | 2574 __ Push(a1); |
| 2596 __ mov(a0, a3); | 2575 __ mov(a0, a3); |
| 2597 ToObjectStub stub(masm->isolate()); | 2576 ToObjectStub stub(masm->isolate()); |
| 2598 __ CallStub(&stub); | 2577 __ CallStub(&stub); |
| 2599 __ pop(a1); | 2578 __ pop(a1); |
| 2600 } | 2579 } |
| 2601 __ Branch(USE_DELAY_SLOT, cont); | 2580 __ Branch(USE_DELAY_SLOT, cont); |
| 2602 __ sd(v0, MemOperand(sp, argc * kPointerSize)); | 2581 __ sd(v0, MemOperand(sp, argc * kPointerSize)); |
| 2603 } | 2582 } |
| 2604 | 2583 |
| 2605 | 2584 |
| 2606 static void CallFunctionNoFeedback(MacroAssembler* masm, | 2585 static void CallFunctionNoFeedback(MacroAssembler* masm, |
| 2607 int argc, bool needs_checks, | 2586 int argc, bool needs_checks, |
| 2608 bool call_as_method) { | 2587 bool call_as_method) { |
| 2609 // a1 : the function to call | 2588 // a1 : the function to call |
| 2610 Label slow, non_function, wrap, cont; | 2589 Label slow, wrap, cont; |
| 2611 | 2590 |
| 2612 if (needs_checks) { | 2591 if (needs_checks) { |
| 2613 // Check that the function is really a JavaScript function. | 2592 // Check that the function is really a JavaScript function. |
| 2614 // a1: pushed function (to be verified) | 2593 // a1: pushed function (to be verified) |
| 2615 __ JumpIfSmi(a1, &non_function); | 2594 __ JumpIfSmi(a1, &slow); |
| 2616 | 2595 |
| 2617 // Goto slow case if we do not have a function. | 2596 // Goto slow case if we do not have a function. |
| 2618 __ GetObjectType(a1, a4, a4); | 2597 __ GetObjectType(a1, a4, a4); |
| 2619 __ Branch(&slow, ne, a4, Operand(JS_FUNCTION_TYPE)); | 2598 __ Branch(&slow, ne, a4, Operand(JS_FUNCTION_TYPE)); |
| 2620 } | 2599 } |
| 2621 | 2600 |
| 2622 // Fast-case: Invoke the function now. | 2601 // Fast-case: Invoke the function now. |
| 2623 // a1: pushed function | 2602 // a1: pushed function |
| 2624 ParameterCount actual(argc); | 2603 ParameterCount actual(argc); |
| 2625 | 2604 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2639 __ jmp(&wrap); | 2618 __ jmp(&wrap); |
| 2640 } | 2619 } |
| 2641 | 2620 |
| 2642 __ bind(&cont); | 2621 __ bind(&cont); |
| 2643 } | 2622 } |
| 2644 __ InvokeFunction(a1, actual, JUMP_FUNCTION, NullCallWrapper()); | 2623 __ InvokeFunction(a1, actual, JUMP_FUNCTION, NullCallWrapper()); |
| 2645 | 2624 |
| 2646 if (needs_checks) { | 2625 if (needs_checks) { |
| 2647 // Slow-case: Non-function called. | 2626 // Slow-case: Non-function called. |
| 2648 __ bind(&slow); | 2627 __ bind(&slow); |
| 2649 EmitSlowCase(masm, argc, &non_function); | 2628 EmitSlowCase(masm, argc); |
| 2650 } | 2629 } |
| 2651 | 2630 |
| 2652 if (call_as_method) { | 2631 if (call_as_method) { |
| 2653 __ bind(&wrap); | 2632 __ bind(&wrap); |
| 2654 // Wrap the receiver and patch it back onto the stack. | 2633 // Wrap the receiver and patch it back onto the stack. |
| 2655 EmitWrapCase(masm, argc, &cont); | 2634 EmitWrapCase(masm, argc, &cont); |
| 2656 } | 2635 } |
| 2657 } | 2636 } |
| 2658 | 2637 |
| 2659 | 2638 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2812 | 2791 |
| 2813 __ mov(a2, a4); | 2792 __ mov(a2, a4); |
| 2814 __ mov(a3, a1); | 2793 __ mov(a3, a1); |
| 2815 ArrayConstructorStub stub(masm->isolate(), arg_count()); | 2794 ArrayConstructorStub stub(masm->isolate(), arg_count()); |
| 2816 __ TailCallStub(&stub); | 2795 __ TailCallStub(&stub); |
| 2817 | 2796 |
| 2818 __ bind(&miss); | 2797 __ bind(&miss); |
| 2819 GenerateMiss(masm); | 2798 GenerateMiss(masm); |
| 2820 | 2799 |
| 2821 // The slow case, we need this no matter what to complete a call after a miss. | 2800 // The slow case, we need this no matter what to complete a call after a miss. |
| 2822 CallFunctionNoFeedback(masm, | 2801 __ li(a0, Operand(arg_count())); |
| 2823 arg_count(), | 2802 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 2824 true, | |
| 2825 CallAsMethod()); | |
| 2826 | |
| 2827 // Unreachable. | |
| 2828 __ stop("Unexpected code address"); | |
| 2829 } | 2803 } |
| 2830 | 2804 |
| 2831 | 2805 |
| 2832 void CallICStub::Generate(MacroAssembler* masm) { | 2806 void CallICStub::Generate(MacroAssembler* masm) { |
| 2833 // a1 - function | 2807 // a1 - function |
| 2834 // a3 - slot id (Smi) | 2808 // a3 - slot id (Smi) |
| 2835 // a2 - vector | 2809 // a2 - vector |
| 2836 const int with_types_offset = | 2810 const int with_types_offset = |
| 2837 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); | 2811 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); |
| 2838 const int generic_offset = | 2812 const int generic_offset = |
| 2839 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); | 2813 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); |
| 2840 Label extra_checks_or_miss, slow_start; | 2814 Label extra_checks_or_miss, slow_start; |
| 2841 Label slow, non_function, wrap, cont; | 2815 Label slow, wrap, cont; |
| 2842 Label have_js_function; | 2816 Label have_js_function; |
| 2843 int argc = arg_count(); | 2817 int argc = arg_count(); |
| 2844 ParameterCount actual(argc); | 2818 ParameterCount actual(argc); |
| 2845 | 2819 |
| 2846 // The checks. First, does r1 match the recorded monomorphic target? | 2820 // The checks. First, does r1 match the recorded monomorphic target? |
| 2847 __ dsrl(a4, a3, 32 - kPointerSizeLog2); | 2821 __ dsrl(a4, a3, 32 - kPointerSizeLog2); |
| 2848 __ Daddu(a4, a2, Operand(a4)); | 2822 __ Daddu(a4, a2, Operand(a4)); |
| 2849 __ ld(a4, FieldMemOperand(a4, FixedArray::kHeaderSize)); | 2823 __ ld(a4, FieldMemOperand(a4, FixedArray::kHeaderSize)); |
| 2850 | 2824 |
| 2851 // We don't know that we have a weak cell. We might have a private symbol | 2825 // We don't know that we have a weak cell. We might have a private symbol |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2885 __ JumpIfSmi(a3, &wrap); | 2859 __ JumpIfSmi(a3, &wrap); |
| 2886 __ GetObjectType(a3, a4, a4); | 2860 __ GetObjectType(a3, a4, a4); |
| 2887 __ Branch(&wrap, lt, a4, Operand(FIRST_SPEC_OBJECT_TYPE)); | 2861 __ Branch(&wrap, lt, a4, Operand(FIRST_SPEC_OBJECT_TYPE)); |
| 2888 | 2862 |
| 2889 __ bind(&cont); | 2863 __ bind(&cont); |
| 2890 } | 2864 } |
| 2891 | 2865 |
| 2892 __ InvokeFunction(a1, actual, JUMP_FUNCTION, NullCallWrapper()); | 2866 __ InvokeFunction(a1, actual, JUMP_FUNCTION, NullCallWrapper()); |
| 2893 | 2867 |
| 2894 __ bind(&slow); | 2868 __ bind(&slow); |
| 2895 EmitSlowCase(masm, argc, &non_function); | 2869 EmitSlowCase(masm, argc); |
| 2896 | 2870 |
| 2897 if (CallAsMethod()) { | 2871 if (CallAsMethod()) { |
| 2898 __ bind(&wrap); | 2872 __ bind(&wrap); |
| 2899 EmitWrapCase(masm, argc, &cont); | 2873 EmitWrapCase(masm, argc, &cont); |
| 2900 } | 2874 } |
| 2901 | 2875 |
| 2902 __ bind(&extra_checks_or_miss); | 2876 __ bind(&extra_checks_or_miss); |
| 2903 Label uninitialized, miss; | 2877 Label uninitialized, miss; |
| 2904 | 2878 |
| 2905 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); | 2879 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2972 __ Branch(&have_js_function); | 2946 __ Branch(&have_js_function); |
| 2973 | 2947 |
| 2974 // We are here because tracing is on or we encountered a MISS case we can't | 2948 // We are here because tracing is on or we encountered a MISS case we can't |
| 2975 // handle here. | 2949 // handle here. |
| 2976 __ bind(&miss); | 2950 __ bind(&miss); |
| 2977 GenerateMiss(masm); | 2951 GenerateMiss(masm); |
| 2978 | 2952 |
| 2979 // the slow case | 2953 // the slow case |
| 2980 __ bind(&slow_start); | 2954 __ bind(&slow_start); |
| 2981 // Check that the function is really a JavaScript function. | 2955 // Check that the function is really a JavaScript function. |
| 2982 // r1: pushed function (to be verified) | 2956 // a1: pushed function (to be verified) |
| 2983 __ JumpIfSmi(a1, &non_function); | 2957 __ JumpIfSmi(a1, &slow); |
| 2984 | 2958 |
| 2985 // Goto slow case if we do not have a function. | 2959 // Goto slow case if we do not have a function. |
| 2986 __ GetObjectType(a1, a4, a4); | 2960 __ GetObjectType(a1, a4, a4); |
| 2987 __ Branch(&slow, ne, a4, Operand(JS_FUNCTION_TYPE)); | 2961 __ Branch(&slow, ne, a4, Operand(JS_FUNCTION_TYPE)); |
| 2988 __ Branch(&have_js_function); | 2962 __ Branch(&have_js_function); |
| 2989 } | 2963 } |
| 2990 | 2964 |
| 2991 | 2965 |
| 2992 void CallICStub::GenerateMiss(MacroAssembler* masm) { | 2966 void CallICStub::GenerateMiss(MacroAssembler* masm) { |
| 2993 FrameScope scope(masm, StackFrame::INTERNAL); | 2967 FrameScope scope(masm, StackFrame::INTERNAL); |
| (...skipping 2822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5816 MemOperand(fp, 6 * kPointerSize), NULL); | 5790 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5817 } | 5791 } |
| 5818 | 5792 |
| 5819 | 5793 |
| 5820 #undef __ | 5794 #undef __ |
| 5821 | 5795 |
| 5822 } // namespace internal | 5796 } // namespace internal |
| 5823 } // namespace v8 | 5797 } // namespace v8 |
| 5824 | 5798 |
| 5825 #endif // V8_TARGET_ARCH_MIPS64 | 5799 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |