| 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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
| 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 2567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2578 | 2578 |
| 2579 | 2579 |
| 2580 void CallICStub::Generate(MacroAssembler* masm) { | 2580 void CallICStub::Generate(MacroAssembler* masm) { |
| 2581 // a1 - function | 2581 // a1 - function |
| 2582 // a3 - slot id (Smi) | 2582 // a3 - slot id (Smi) |
| 2583 // a2 - vector | 2583 // a2 - vector |
| 2584 const int with_types_offset = | 2584 const int with_types_offset = |
| 2585 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); | 2585 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); |
| 2586 const int generic_offset = | 2586 const int generic_offset = |
| 2587 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); | 2587 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); |
| 2588 Label extra_checks_or_miss, call; | 2588 Label extra_checks_or_miss, call, call_function; |
| 2589 int argc = arg_count(); | 2589 int argc = arg_count(); |
| 2590 ParameterCount actual(argc); | 2590 ParameterCount actual(argc); |
| 2591 | 2591 |
| 2592 // The checks. First, does r1 match the recorded monomorphic target? | 2592 // The checks. First, does r1 match the recorded monomorphic target? |
| 2593 __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize); | 2593 __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize); |
| 2594 __ Addu(t0, a2, Operand(t0)); | 2594 __ Addu(t0, a2, Operand(t0)); |
| 2595 __ lw(t0, FieldMemOperand(t0, FixedArray::kHeaderSize)); | 2595 __ lw(t0, FieldMemOperand(t0, FixedArray::kHeaderSize)); |
| 2596 | 2596 |
| 2597 // We don't know that we have a weak cell. We might have a private symbol | 2597 // We don't know that we have a weak cell. We might have a private symbol |
| 2598 // or an AllocationSite, but the memory is safe to examine. | 2598 // or an AllocationSite, but the memory is safe to examine. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2615 // convincing us that we have a monomorphic JSFunction. | 2615 // convincing us that we have a monomorphic JSFunction. |
| 2616 __ JumpIfSmi(a1, &extra_checks_or_miss); | 2616 __ JumpIfSmi(a1, &extra_checks_or_miss); |
| 2617 | 2617 |
| 2618 // Increment the call count for monomorphic function calls. | 2618 // Increment the call count for monomorphic function calls. |
| 2619 __ sll(at, a3, kPointerSizeLog2 - kSmiTagSize); | 2619 __ sll(at, a3, kPointerSizeLog2 - kSmiTagSize); |
| 2620 __ Addu(at, a2, Operand(at)); | 2620 __ Addu(at, a2, Operand(at)); |
| 2621 __ lw(a3, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize)); | 2621 __ lw(a3, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize)); |
| 2622 __ Addu(a3, a3, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); | 2622 __ Addu(a3, a3, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); |
| 2623 __ sw(a3, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize)); | 2623 __ sw(a3, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize)); |
| 2624 | 2624 |
| 2625 __ bind(&call); | 2625 __ bind(&call_function); |
| 2626 __ li(a0, Operand(argc)); | 2626 __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode()), |
| 2627 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 2627 RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg), |
| 2628 USE_DELAY_SLOT); |
| 2629 __ li(a0, Operand(argc)); // In delay slot. |
| 2628 | 2630 |
| 2629 __ bind(&extra_checks_or_miss); | 2631 __ bind(&extra_checks_or_miss); |
| 2630 Label uninitialized, miss, not_allocation_site; | 2632 Label uninitialized, miss, not_allocation_site; |
| 2631 | 2633 |
| 2632 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); | 2634 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); |
| 2633 __ Branch(&call, eq, t0, Operand(at)); | 2635 __ Branch(&call, eq, t0, Operand(at)); |
| 2634 | 2636 |
| 2635 // Verify that t0 contains an AllocationSite | 2637 // Verify that t0 contains an AllocationSite |
| 2636 __ lw(t1, FieldMemOperand(t0, HeapObject::kMapOffset)); | 2638 __ lw(t1, FieldMemOperand(t0, HeapObject::kMapOffset)); |
| 2637 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); | 2639 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2658 __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize); | 2660 __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize); |
| 2659 __ Addu(t0, a2, Operand(t0)); | 2661 __ Addu(t0, a2, Operand(t0)); |
| 2660 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); | 2662 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); |
| 2661 __ sw(at, FieldMemOperand(t0, FixedArray::kHeaderSize)); | 2663 __ sw(at, FieldMemOperand(t0, FixedArray::kHeaderSize)); |
| 2662 // We have to update statistics for runtime profiling. | 2664 // We have to update statistics for runtime profiling. |
| 2663 __ lw(t0, FieldMemOperand(a2, with_types_offset)); | 2665 __ lw(t0, FieldMemOperand(a2, with_types_offset)); |
| 2664 __ Subu(t0, t0, Operand(Smi::FromInt(1))); | 2666 __ Subu(t0, t0, Operand(Smi::FromInt(1))); |
| 2665 __ sw(t0, FieldMemOperand(a2, with_types_offset)); | 2667 __ sw(t0, FieldMemOperand(a2, with_types_offset)); |
| 2666 __ lw(t0, FieldMemOperand(a2, generic_offset)); | 2668 __ lw(t0, FieldMemOperand(a2, generic_offset)); |
| 2667 __ Addu(t0, t0, Operand(Smi::FromInt(1))); | 2669 __ Addu(t0, t0, Operand(Smi::FromInt(1))); |
| 2668 __ Branch(USE_DELAY_SLOT, &call); | 2670 __ sw(t0, FieldMemOperand(a2, generic_offset)); |
| 2669 __ sw(t0, FieldMemOperand(a2, generic_offset)); // In delay slot. | 2671 |
| 2672 __ bind(&call); |
| 2673 __ Jump(masm->isolate()->builtins()->Call(convert_mode()), |
| 2674 RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg), |
| 2675 USE_DELAY_SLOT); |
| 2676 __ li(a0, Operand(argc)); // In delay slot. |
| 2670 | 2677 |
| 2671 __ bind(&uninitialized); | 2678 __ bind(&uninitialized); |
| 2672 | 2679 |
| 2673 // We are going monomorphic, provided we actually have a JSFunction. | 2680 // We are going monomorphic, provided we actually have a JSFunction. |
| 2674 __ JumpIfSmi(a1, &miss); | 2681 __ JumpIfSmi(a1, &miss); |
| 2675 | 2682 |
| 2676 // Goto miss case if we do not have a function. | 2683 // Goto miss case if we do not have a function. |
| 2677 __ GetObjectType(a1, t0, t0); | 2684 __ GetObjectType(a1, t0, t0); |
| 2678 __ Branch(&miss, ne, t0, Operand(JS_FUNCTION_TYPE)); | 2685 __ Branch(&miss, ne, t0, Operand(JS_FUNCTION_TYPE)); |
| 2679 | 2686 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2705 // a3 - slot | 2712 // a3 - slot |
| 2706 // a1 - function | 2713 // a1 - function |
| 2707 { | 2714 { |
| 2708 FrameScope scope(masm, StackFrame::INTERNAL); | 2715 FrameScope scope(masm, StackFrame::INTERNAL); |
| 2709 CreateWeakCellStub create_stub(masm->isolate()); | 2716 CreateWeakCellStub create_stub(masm->isolate()); |
| 2710 __ Push(a1); | 2717 __ Push(a1); |
| 2711 __ CallStub(&create_stub); | 2718 __ CallStub(&create_stub); |
| 2712 __ Pop(a1); | 2719 __ Pop(a1); |
| 2713 } | 2720 } |
| 2714 | 2721 |
| 2715 __ Branch(&call); | 2722 __ Branch(&call_function); |
| 2716 | 2723 |
| 2717 // We are here because tracing is on or we encountered a MISS case we can't | 2724 // We are here because tracing is on or we encountered a MISS case we can't |
| 2718 // handle here. | 2725 // handle here. |
| 2719 __ bind(&miss); | 2726 __ bind(&miss); |
| 2720 GenerateMiss(masm); | 2727 GenerateMiss(masm); |
| 2721 | 2728 |
| 2722 __ Branch(&call); | 2729 __ Branch(&call); |
| 2723 } | 2730 } |
| 2724 | 2731 |
| 2725 | 2732 |
| (...skipping 2849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5575 MemOperand(fp, 6 * kPointerSize), NULL); | 5582 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5576 } | 5583 } |
| 5577 | 5584 |
| 5578 | 5585 |
| 5579 #undef __ | 5586 #undef __ |
| 5580 | 5587 |
| 5581 } // namespace internal | 5588 } // namespace internal |
| 5582 } // namespace v8 | 5589 } // namespace v8 |
| 5583 | 5590 |
| 5584 #endif // V8_TARGET_ARCH_MIPS | 5591 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |