| 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 2635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2646 __ mov(a3, a1); | 2646 __ mov(a3, a1); |
| 2647 ArrayConstructorStub stub(masm->isolate(), arg_count()); | 2647 ArrayConstructorStub stub(masm->isolate(), arg_count()); |
| 2648 __ TailCallStub(&stub); | 2648 __ TailCallStub(&stub); |
| 2649 } | 2649 } |
| 2650 | 2650 |
| 2651 | 2651 |
| 2652 void CallICStub::Generate(MacroAssembler* masm) { | 2652 void CallICStub::Generate(MacroAssembler* masm) { |
| 2653 // a1 - function | 2653 // a1 - function |
| 2654 // a3 - slot id (Smi) | 2654 // a3 - slot id (Smi) |
| 2655 // a2 - vector | 2655 // a2 - vector |
| 2656 const int with_types_offset = | |
| 2657 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); | |
| 2658 const int generic_offset = | |
| 2659 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); | |
| 2660 Label extra_checks_or_miss, call, call_function; | 2656 Label extra_checks_or_miss, call, call_function; |
| 2661 int argc = arg_count(); | 2657 int argc = arg_count(); |
| 2662 ParameterCount actual(argc); | 2658 ParameterCount actual(argc); |
| 2663 | 2659 |
| 2664 // The checks. First, does r1 match the recorded monomorphic target? | 2660 // The checks. First, does r1 match the recorded monomorphic target? |
| 2665 __ dsrl(a4, a3, 32 - kPointerSizeLog2); | 2661 __ dsrl(a4, a3, 32 - kPointerSizeLog2); |
| 2666 __ Daddu(a4, a2, Operand(a4)); | 2662 __ Daddu(a4, a2, Operand(a4)); |
| 2667 __ ld(a4, FieldMemOperand(a4, FixedArray::kHeaderSize)); | 2663 __ ld(a4, FieldMemOperand(a4, FixedArray::kHeaderSize)); |
| 2668 | 2664 |
| 2669 // We don't know that we have a weak cell. We might have a private symbol | 2665 // We don't know that we have a weak cell. We might have a private symbol |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2726 | 2722 |
| 2727 // We are going megamorphic. If the feedback is a JSFunction, it is fine | 2723 // We are going megamorphic. If the feedback is a JSFunction, it is fine |
| 2728 // to handle it here. More complex cases are dealt with in the runtime. | 2724 // to handle it here. More complex cases are dealt with in the runtime. |
| 2729 __ AssertNotSmi(a4); | 2725 __ AssertNotSmi(a4); |
| 2730 __ GetObjectType(a4, a5, a5); | 2726 __ GetObjectType(a4, a5, a5); |
| 2731 __ Branch(&miss, ne, a5, Operand(JS_FUNCTION_TYPE)); | 2727 __ Branch(&miss, ne, a5, Operand(JS_FUNCTION_TYPE)); |
| 2732 __ dsrl(a4, a3, 32 - kPointerSizeLog2); | 2728 __ dsrl(a4, a3, 32 - kPointerSizeLog2); |
| 2733 __ Daddu(a4, a2, Operand(a4)); | 2729 __ Daddu(a4, a2, Operand(a4)); |
| 2734 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); | 2730 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); |
| 2735 __ sd(at, FieldMemOperand(a4, FixedArray::kHeaderSize)); | 2731 __ sd(at, FieldMemOperand(a4, FixedArray::kHeaderSize)); |
| 2736 // We have to update statistics for runtime profiling. | |
| 2737 __ ld(a4, FieldMemOperand(a2, with_types_offset)); | |
| 2738 __ Dsubu(a4, a4, Operand(Smi::FromInt(1))); | |
| 2739 __ sd(a4, FieldMemOperand(a2, with_types_offset)); | |
| 2740 __ ld(a4, FieldMemOperand(a2, generic_offset)); | |
| 2741 __ Daddu(a4, a4, Operand(Smi::FromInt(1))); | |
| 2742 __ sd(a4, FieldMemOperand(a2, generic_offset)); | |
| 2743 | 2732 |
| 2744 __ bind(&call); | 2733 __ bind(&call); |
| 2745 __ Jump(masm->isolate()->builtins()->Call(convert_mode()), | 2734 __ Jump(masm->isolate()->builtins()->Call(convert_mode()), |
| 2746 RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg), | 2735 RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg), |
| 2747 USE_DELAY_SLOT); | 2736 USE_DELAY_SLOT); |
| 2748 __ li(a0, Operand(argc)); // In delay slot. | 2737 __ li(a0, Operand(argc)); // In delay slot. |
| 2749 | 2738 |
| 2750 __ bind(&uninitialized); | 2739 __ bind(&uninitialized); |
| 2751 | 2740 |
| 2752 // We are going monomorphic, provided we actually have a JSFunction. | 2741 // We are going monomorphic, provided we actually have a JSFunction. |
| 2753 __ JumpIfSmi(a1, &miss); | 2742 __ JumpIfSmi(a1, &miss); |
| 2754 | 2743 |
| 2755 // Goto miss case if we do not have a function. | 2744 // Goto miss case if we do not have a function. |
| 2756 __ GetObjectType(a1, a4, a4); | 2745 __ GetObjectType(a1, a4, a4); |
| 2757 __ Branch(&miss, ne, a4, Operand(JS_FUNCTION_TYPE)); | 2746 __ Branch(&miss, ne, a4, Operand(JS_FUNCTION_TYPE)); |
| 2758 | 2747 |
| 2759 // Make sure the function is not the Array() function, which requires special | 2748 // Make sure the function is not the Array() function, which requires special |
| 2760 // behavior on MISS. | 2749 // behavior on MISS. |
| 2761 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, a4); | 2750 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, a4); |
| 2762 __ Branch(&miss, eq, a1, Operand(a4)); | 2751 __ Branch(&miss, eq, a1, Operand(a4)); |
| 2763 | 2752 |
| 2764 // Make sure the function belongs to the same native context. | 2753 // Make sure the function belongs to the same native context. |
| 2765 __ ld(t0, FieldMemOperand(a1, JSFunction::kContextOffset)); | 2754 __ ld(t0, FieldMemOperand(a1, JSFunction::kContextOffset)); |
| 2766 __ ld(t0, ContextMemOperand(t0, Context::NATIVE_CONTEXT_INDEX)); | 2755 __ ld(t0, ContextMemOperand(t0, Context::NATIVE_CONTEXT_INDEX)); |
| 2767 __ ld(t1, NativeContextMemOperand()); | 2756 __ ld(t1, NativeContextMemOperand()); |
| 2768 __ Branch(&miss, ne, t0, Operand(t1)); | 2757 __ Branch(&miss, ne, t0, Operand(t1)); |
| 2769 | 2758 |
| 2770 // Update stats. | |
| 2771 __ ld(a4, FieldMemOperand(a2, with_types_offset)); | |
| 2772 __ Daddu(a4, a4, Operand(Smi::FromInt(1))); | |
| 2773 __ sd(a4, FieldMemOperand(a2, with_types_offset)); | |
| 2774 | |
| 2775 // Initialize the call counter. | 2759 // Initialize the call counter. |
| 2776 __ dsrl(at, a3, 32 - kPointerSizeLog2); | 2760 __ dsrl(at, a3, 32 - kPointerSizeLog2); |
| 2777 __ Daddu(at, a2, Operand(at)); | 2761 __ Daddu(at, a2, Operand(at)); |
| 2778 __ li(t0, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); | 2762 __ li(t0, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); |
| 2779 __ sd(t0, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize)); | 2763 __ sd(t0, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize)); |
| 2780 | 2764 |
| 2781 // Store the function. Use a stub since we need a frame for allocation. | 2765 // Store the function. Use a stub since we need a frame for allocation. |
| 2782 // a2 - vector | 2766 // a2 - vector |
| 2783 // a3 - slot | 2767 // a3 - slot |
| 2784 // a1 - function | 2768 // a1 - function |
| (...skipping 2826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5611 MemOperand(fp, 6 * kPointerSize), NULL); | 5595 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5612 } | 5596 } |
| 5613 | 5597 |
| 5614 | 5598 |
| 5615 #undef __ | 5599 #undef __ |
| 5616 | 5600 |
| 5617 } // namespace internal | 5601 } // namespace internal |
| 5618 } // namespace v8 | 5602 } // namespace v8 |
| 5619 | 5603 |
| 5620 #endif // V8_TARGET_ARCH_MIPS64 | 5604 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |