| 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 2745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2756 | 2756 |
| 2757 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { | 2757 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { |
| 2758 __ ld(vector, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 2758 __ ld(vector, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 2759 __ ld(vector, FieldMemOperand(vector, | 2759 __ ld(vector, FieldMemOperand(vector, |
| 2760 JSFunction::kSharedFunctionInfoOffset)); | 2760 JSFunction::kSharedFunctionInfoOffset)); |
| 2761 __ ld(vector, FieldMemOperand(vector, | 2761 __ ld(vector, FieldMemOperand(vector, |
| 2762 SharedFunctionInfo::kFeedbackVectorOffset)); | 2762 SharedFunctionInfo::kFeedbackVectorOffset)); |
| 2763 } | 2763 } |
| 2764 | 2764 |
| 2765 | 2765 |
| 2766 void CallIC_ArrayStub::Generate(MacroAssembler* masm) { | 2766 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { |
| 2767 // a1 - function | 2767 // a1 - function |
| 2768 // a3 - slot id | 2768 // a3 - slot id |
| 2769 // a2 - vector | 2769 // a2 - vector |
| 2770 Label miss; | 2770 // a4 - allocation site (loaded from vector[slot]) |
| 2771 | |
| 2772 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, at); | 2771 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, at); |
| 2773 __ Branch(&miss, ne, a1, Operand(at)); | 2772 __ Branch(miss, ne, a1, Operand(at)); |
| 2774 | |
| 2775 __ li(a0, Operand(arg_count())); | |
| 2776 __ dsrl(at, a3, 32 - kPointerSizeLog2); | |
| 2777 __ Daddu(at, a2, Operand(at)); | |
| 2778 __ ld(a4, FieldMemOperand(at, FixedArray::kHeaderSize)); | |
| 2779 | |
| 2780 // Verify that a4 contains an AllocationSite | |
| 2781 __ ld(a5, FieldMemOperand(a4, HeapObject::kMapOffset)); | |
| 2782 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); | |
| 2783 __ Branch(&miss, ne, a5, Operand(at)); | |
| 2784 | 2773 |
| 2785 // Increment the call count for monomorphic function calls. | 2774 // Increment the call count for monomorphic function calls. |
| 2786 __ dsrl(t0, a3, 32 - kPointerSizeLog2); | 2775 __ dsrl(t0, a3, 32 - kPointerSizeLog2); |
| 2787 __ Daddu(a3, a2, Operand(t0)); | 2776 __ Daddu(a3, a2, Operand(t0)); |
| 2788 __ ld(t0, FieldMemOperand(a3, FixedArray::kHeaderSize + kPointerSize)); | 2777 __ ld(t0, FieldMemOperand(a3, FixedArray::kHeaderSize + kPointerSize)); |
| 2789 __ Daddu(t0, t0, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); | 2778 __ Daddu(t0, t0, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); |
| 2790 __ sd(t0, FieldMemOperand(a3, FixedArray::kHeaderSize + kPointerSize)); | 2779 __ sd(t0, FieldMemOperand(a3, FixedArray::kHeaderSize + kPointerSize)); |
| 2791 | 2780 |
| 2792 __ mov(a2, a4); | 2781 __ mov(a2, a4); |
| 2793 __ mov(a3, a1); | 2782 __ mov(a3, a1); |
| 2794 ArrayConstructorStub stub(masm->isolate(), arg_count()); | 2783 ArrayConstructorStub stub(masm->isolate(), arg_count()); |
| 2795 __ TailCallStub(&stub); | 2784 __ TailCallStub(&stub); |
| 2796 | |
| 2797 __ bind(&miss); | |
| 2798 GenerateMiss(masm); | |
| 2799 | |
| 2800 // The slow case, we need this no matter what to complete a call after a miss. | |
| 2801 __ li(a0, Operand(arg_count())); | |
| 2802 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | |
| 2803 } | 2785 } |
| 2804 | 2786 |
| 2805 | 2787 |
| 2806 void CallICStub::Generate(MacroAssembler* masm) { | 2788 void CallICStub::Generate(MacroAssembler* masm) { |
| 2807 // a1 - function | 2789 // a1 - function |
| 2808 // a3 - slot id (Smi) | 2790 // a3 - slot id (Smi) |
| 2809 // a2 - vector | 2791 // a2 - vector |
| 2810 const int with_types_offset = | 2792 const int with_types_offset = |
| 2811 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); | 2793 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); |
| 2812 const int generic_offset = | 2794 const int generic_offset = |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2867 | 2849 |
| 2868 __ bind(&slow); | 2850 __ bind(&slow); |
| 2869 EmitSlowCase(masm, argc); | 2851 EmitSlowCase(masm, argc); |
| 2870 | 2852 |
| 2871 if (CallAsMethod()) { | 2853 if (CallAsMethod()) { |
| 2872 __ bind(&wrap); | 2854 __ bind(&wrap); |
| 2873 EmitWrapCase(masm, argc, &cont); | 2855 EmitWrapCase(masm, argc, &cont); |
| 2874 } | 2856 } |
| 2875 | 2857 |
| 2876 __ bind(&extra_checks_or_miss); | 2858 __ bind(&extra_checks_or_miss); |
| 2877 Label uninitialized, miss; | 2859 Label uninitialized, miss, not_allocation_site; |
| 2878 | 2860 |
| 2879 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); | 2861 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); |
| 2880 __ Branch(&slow_start, eq, a4, Operand(at)); | 2862 __ Branch(&slow_start, eq, a4, Operand(at)); |
| 2881 | 2863 |
| 2864 // Verify that a4 contains an AllocationSite |
| 2865 __ ld(a5, FieldMemOperand(a4, HeapObject::kMapOffset)); |
| 2866 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); |
| 2867 __ Branch(¬_allocation_site, ne, a5, Operand(at)); |
| 2868 |
| 2869 HandleArrayCase(masm, &miss); |
| 2870 |
| 2871 __ bind(¬_allocation_site); |
| 2872 |
| 2882 // The following cases attempt to handle MISS cases without going to the | 2873 // The following cases attempt to handle MISS cases without going to the |
| 2883 // runtime. | 2874 // runtime. |
| 2884 if (FLAG_trace_ic) { | 2875 if (FLAG_trace_ic) { |
| 2885 __ Branch(&miss); | 2876 __ Branch(&miss); |
| 2886 } | 2877 } |
| 2887 | 2878 |
| 2888 __ LoadRoot(at, Heap::kuninitialized_symbolRootIndex); | 2879 __ LoadRoot(at, Heap::kuninitialized_symbolRootIndex); |
| 2889 __ Branch(&uninitialized, eq, a4, Operand(at)); | 2880 __ Branch(&uninitialized, eq, a4, Operand(at)); |
| 2890 | 2881 |
| 2891 // We are going megamorphic. If the feedback is a JSFunction, it is fine | 2882 // We are going megamorphic. If the feedback is a JSFunction, it is fine |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2963 } | 2954 } |
| 2964 | 2955 |
| 2965 | 2956 |
| 2966 void CallICStub::GenerateMiss(MacroAssembler* masm) { | 2957 void CallICStub::GenerateMiss(MacroAssembler* masm) { |
| 2967 FrameScope scope(masm, StackFrame::INTERNAL); | 2958 FrameScope scope(masm, StackFrame::INTERNAL); |
| 2968 | 2959 |
| 2969 // Push the receiver and the function and feedback info. | 2960 // Push the receiver and the function and feedback info. |
| 2970 __ Push(a1, a2, a3); | 2961 __ Push(a1, a2, a3); |
| 2971 | 2962 |
| 2972 // Call the entry. | 2963 // Call the entry. |
| 2973 Runtime::FunctionId id = GetICState() == DEFAULT | 2964 __ CallRuntime(Runtime::kCallIC_Miss, 3); |
| 2974 ? Runtime::kCallIC_Miss // | |
| 2975 : Runtime::kCallIC_Customization_Miss; | |
| 2976 __ CallRuntime(id, 3); | |
| 2977 | 2965 |
| 2978 // Move result to a1 and exit the internal frame. | 2966 // Move result to a1 and exit the internal frame. |
| 2979 __ mov(a1, v0); | 2967 __ mov(a1, v0); |
| 2980 } | 2968 } |
| 2981 | 2969 |
| 2982 | 2970 |
| 2983 void StringCharCodeAtGenerator::GenerateSlow( | 2971 void StringCharCodeAtGenerator::GenerateSlow( |
| 2984 MacroAssembler* masm, EmbedMode embed_mode, | 2972 MacroAssembler* masm, EmbedMode embed_mode, |
| 2985 const RuntimeCallHelper& call_helper) { | 2973 const RuntimeCallHelper& call_helper) { |
| 2986 __ Abort(kUnexpectedFallthroughToCharCodeAtSlowCase); | 2974 __ Abort(kUnexpectedFallthroughToCharCodeAtSlowCase); |
| (...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4524 } | 4512 } |
| 4525 | 4513 |
| 4526 | 4514 |
| 4527 void CallICTrampolineStub::Generate(MacroAssembler* masm) { | 4515 void CallICTrampolineStub::Generate(MacroAssembler* masm) { |
| 4528 EmitLoadTypeFeedbackVector(masm, a2); | 4516 EmitLoadTypeFeedbackVector(masm, a2); |
| 4529 CallICStub stub(isolate(), state()); | 4517 CallICStub stub(isolate(), state()); |
| 4530 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); | 4518 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); |
| 4531 } | 4519 } |
| 4532 | 4520 |
| 4533 | 4521 |
| 4534 void CallIC_ArrayTrampolineStub::Generate(MacroAssembler* masm) { | |
| 4535 EmitLoadTypeFeedbackVector(masm, a2); | |
| 4536 CallIC_ArrayStub stub(isolate(), state()); | |
| 4537 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); | |
| 4538 } | |
| 4539 | |
| 4540 | |
| 4541 void LoadICStub::Generate(MacroAssembler* masm) { GenerateImpl(masm, false); } | 4522 void LoadICStub::Generate(MacroAssembler* masm) { GenerateImpl(masm, false); } |
| 4542 | 4523 |
| 4543 | 4524 |
| 4544 void LoadICStub::GenerateForTrampoline(MacroAssembler* masm) { | 4525 void LoadICStub::GenerateForTrampoline(MacroAssembler* masm) { |
| 4545 GenerateImpl(masm, true); | 4526 GenerateImpl(masm, true); |
| 4546 } | 4527 } |
| 4547 | 4528 |
| 4548 | 4529 |
| 4549 static void HandleArrayCases(MacroAssembler* masm, Register feedback, | 4530 static void HandleArrayCases(MacroAssembler* masm, Register feedback, |
| 4550 Register receiver_map, Register scratch1, | 4531 Register receiver_map, Register scratch1, |
| (...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5790 MemOperand(fp, 6 * kPointerSize), NULL); | 5771 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5791 } | 5772 } |
| 5792 | 5773 |
| 5793 | 5774 |
| 5794 #undef __ | 5775 #undef __ |
| 5795 | 5776 |
| 5796 } // namespace internal | 5777 } // namespace internal |
| 5797 } // namespace v8 | 5778 } // namespace v8 |
| 5798 | 5779 |
| 5799 #endif // V8_TARGET_ARCH_MIPS64 | 5780 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |