| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
| 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 2601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2612 | 2612 |
| 2613 | 2613 |
| 2614 void CallICStub::Generate(MacroAssembler* masm) { | 2614 void CallICStub::Generate(MacroAssembler* masm) { |
| 2615 // r4 - function | 2615 // r4 - function |
| 2616 // r6 - slot id (Smi) | 2616 // r6 - slot id (Smi) |
| 2617 // r5 - vector | 2617 // r5 - vector |
| 2618 const int with_types_offset = | 2618 const int with_types_offset = |
| 2619 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); | 2619 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); |
| 2620 const int generic_offset = | 2620 const int generic_offset = |
| 2621 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); | 2621 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); |
| 2622 Label extra_checks_or_miss, call; | 2622 Label extra_checks_or_miss, call, call_function; |
| 2623 int argc = arg_count(); | 2623 int argc = arg_count(); |
| 2624 ParameterCount actual(argc); | 2624 ParameterCount actual(argc); |
| 2625 | 2625 |
| 2626 // The checks. First, does r4 match the recorded monomorphic target? | 2626 // The checks. First, does r4 match the recorded monomorphic target? |
| 2627 __ SmiToPtrArrayOffset(r9, r6); | 2627 __ SmiToPtrArrayOffset(r9, r6); |
| 2628 __ add(r9, r5, r9); | 2628 __ add(r9, r5, r9); |
| 2629 __ LoadP(r7, FieldMemOperand(r9, FixedArray::kHeaderSize)); | 2629 __ LoadP(r7, FieldMemOperand(r9, FixedArray::kHeaderSize)); |
| 2630 | 2630 |
| 2631 // We don't know that we have a weak cell. We might have a private symbol | 2631 // We don't know that we have a weak cell. We might have a private symbol |
| 2632 // or an AllocationSite, but the memory is safe to examine. | 2632 // or an AllocationSite, but the memory is safe to examine. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2649 // The compare above could have been a SMI/SMI comparison. Guard against this | 2649 // The compare above could have been a SMI/SMI comparison. Guard against this |
| 2650 // convincing us that we have a monomorphic JSFunction. | 2650 // convincing us that we have a monomorphic JSFunction. |
| 2651 __ JumpIfSmi(r4, &extra_checks_or_miss); | 2651 __ JumpIfSmi(r4, &extra_checks_or_miss); |
| 2652 | 2652 |
| 2653 // Increment the call count for monomorphic function calls. | 2653 // Increment the call count for monomorphic function calls. |
| 2654 const int count_offset = FixedArray::kHeaderSize + kPointerSize; | 2654 const int count_offset = FixedArray::kHeaderSize + kPointerSize; |
| 2655 __ LoadP(r6, FieldMemOperand(r9, count_offset)); | 2655 __ LoadP(r6, FieldMemOperand(r9, count_offset)); |
| 2656 __ AddSmiLiteral(r6, r6, Smi::FromInt(CallICNexus::kCallCountIncrement), r0); | 2656 __ AddSmiLiteral(r6, r6, Smi::FromInt(CallICNexus::kCallCountIncrement), r0); |
| 2657 __ StoreP(r6, FieldMemOperand(r9, count_offset), r0); | 2657 __ StoreP(r6, FieldMemOperand(r9, count_offset), r0); |
| 2658 | 2658 |
| 2659 __ bind(&call); | 2659 __ bind(&call_function); |
| 2660 __ mov(r3, Operand(argc)); | 2660 __ mov(r3, Operand(argc)); |
| 2661 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 2661 __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode()), |
| 2662 RelocInfo::CODE_TARGET); |
| 2662 | 2663 |
| 2663 __ bind(&extra_checks_or_miss); | 2664 __ bind(&extra_checks_or_miss); |
| 2664 Label uninitialized, miss, not_allocation_site; | 2665 Label uninitialized, miss, not_allocation_site; |
| 2665 | 2666 |
| 2666 __ CompareRoot(r7, Heap::kmegamorphic_symbolRootIndex); | 2667 __ CompareRoot(r7, Heap::kmegamorphic_symbolRootIndex); |
| 2667 __ beq(&call); | 2668 __ beq(&call); |
| 2668 | 2669 |
| 2669 // Verify that r7 contains an AllocationSite | 2670 // Verify that r7 contains an AllocationSite |
| 2670 __ LoadP(r8, FieldMemOperand(r7, HeapObject::kMapOffset)); | 2671 __ LoadP(r8, FieldMemOperand(r7, HeapObject::kMapOffset)); |
| 2671 __ CompareRoot(r8, Heap::kAllocationSiteMapRootIndex); | 2672 __ CompareRoot(r8, Heap::kAllocationSiteMapRootIndex); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2692 __ bne(&miss); | 2693 __ bne(&miss); |
| 2693 __ LoadRoot(ip, Heap::kmegamorphic_symbolRootIndex); | 2694 __ LoadRoot(ip, Heap::kmegamorphic_symbolRootIndex); |
| 2694 __ StoreP(ip, FieldMemOperand(r9, FixedArray::kHeaderSize), r0); | 2695 __ StoreP(ip, FieldMemOperand(r9, FixedArray::kHeaderSize), r0); |
| 2695 // We have to update statistics for runtime profiling. | 2696 // We have to update statistics for runtime profiling. |
| 2696 __ LoadP(r7, FieldMemOperand(r5, with_types_offset)); | 2697 __ LoadP(r7, FieldMemOperand(r5, with_types_offset)); |
| 2697 __ SubSmiLiteral(r7, r7, Smi::FromInt(1), r0); | 2698 __ SubSmiLiteral(r7, r7, Smi::FromInt(1), r0); |
| 2698 __ StoreP(r7, FieldMemOperand(r5, with_types_offset), r0); | 2699 __ StoreP(r7, FieldMemOperand(r5, with_types_offset), r0); |
| 2699 __ LoadP(r7, FieldMemOperand(r5, generic_offset)); | 2700 __ LoadP(r7, FieldMemOperand(r5, generic_offset)); |
| 2700 __ AddSmiLiteral(r7, r7, Smi::FromInt(1), r0); | 2701 __ AddSmiLiteral(r7, r7, Smi::FromInt(1), r0); |
| 2701 __ StoreP(r7, FieldMemOperand(r5, generic_offset), r0); | 2702 __ StoreP(r7, FieldMemOperand(r5, generic_offset), r0); |
| 2702 __ b(&call); | 2703 |
| 2704 __ bind(&call); |
| 2705 __ mov(r3, Operand(argc)); |
| 2706 __ Jump(masm->isolate()->builtins()->Call(convert_mode()), |
| 2707 RelocInfo::CODE_TARGET); |
| 2703 | 2708 |
| 2704 __ bind(&uninitialized); | 2709 __ bind(&uninitialized); |
| 2705 | 2710 |
| 2706 // We are going monomorphic, provided we actually have a JSFunction. | 2711 // We are going monomorphic, provided we actually have a JSFunction. |
| 2707 __ JumpIfSmi(r4, &miss); | 2712 __ JumpIfSmi(r4, &miss); |
| 2708 | 2713 |
| 2709 // Goto miss case if we do not have a function. | 2714 // Goto miss case if we do not have a function. |
| 2710 __ CompareObjectType(r4, r7, r7, JS_FUNCTION_TYPE); | 2715 __ CompareObjectType(r4, r7, r7, JS_FUNCTION_TYPE); |
| 2711 __ bne(&miss); | 2716 __ bne(&miss); |
| 2712 | 2717 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2738 // r6 - slot | 2743 // r6 - slot |
| 2739 // r4 - function | 2744 // r4 - function |
| 2740 { | 2745 { |
| 2741 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 2746 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 2742 CreateWeakCellStub create_stub(masm->isolate()); | 2747 CreateWeakCellStub create_stub(masm->isolate()); |
| 2743 __ Push(r4); | 2748 __ Push(r4); |
| 2744 __ CallStub(&create_stub); | 2749 __ CallStub(&create_stub); |
| 2745 __ Pop(r4); | 2750 __ Pop(r4); |
| 2746 } | 2751 } |
| 2747 | 2752 |
| 2748 __ b(&call); | 2753 __ b(&call_function); |
| 2749 | 2754 |
| 2750 // We are here because tracing is on or we encountered a MISS case we can't | 2755 // We are here because tracing is on or we encountered a MISS case we can't |
| 2751 // handle here. | 2756 // handle here. |
| 2752 __ bind(&miss); | 2757 __ bind(&miss); |
| 2753 GenerateMiss(masm); | 2758 GenerateMiss(masm); |
| 2754 | 2759 |
| 2755 __ b(&call); | 2760 __ b(&call); |
| 2756 } | 2761 } |
| 2757 | 2762 |
| 2758 | 2763 |
| (...skipping 2903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5662 kStackUnwindSpace, NULL, | 5667 kStackUnwindSpace, NULL, |
| 5663 MemOperand(fp, 6 * kPointerSize), NULL); | 5668 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5664 } | 5669 } |
| 5665 | 5670 |
| 5666 | 5671 |
| 5667 #undef __ | 5672 #undef __ |
| 5668 } // namespace internal | 5673 } // namespace internal |
| 5669 } // namespace v8 | 5674 } // namespace v8 |
| 5670 | 5675 |
| 5671 #endif // V8_TARGET_ARCH_PPC | 5676 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |