Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(845)

Side by Side Diff: src/ppc/code-stubs-ppc.cc

Issue 1322103005: PPC: On a call to Array(), we patched a call ic. This CL makes do with a single dispatcher which in… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2718 matching lines...) Expand 10 before | Expand all | Expand 10 after
2729 2729
2730 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { 2730 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) {
2731 __ LoadP(vector, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 2731 __ LoadP(vector, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
2732 __ LoadP(vector, 2732 __ LoadP(vector,
2733 FieldMemOperand(vector, JSFunction::kSharedFunctionInfoOffset)); 2733 FieldMemOperand(vector, JSFunction::kSharedFunctionInfoOffset));
2734 __ LoadP(vector, 2734 __ LoadP(vector,
2735 FieldMemOperand(vector, SharedFunctionInfo::kFeedbackVectorOffset)); 2735 FieldMemOperand(vector, SharedFunctionInfo::kFeedbackVectorOffset));
2736 } 2736 }
2737 2737
2738 2738
2739 void CallIC_ArrayStub::Generate(MacroAssembler* masm) { 2739 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
2740 // r4 - function 2740 // r4 - function
2741 // r6 - slot id 2741 // r6 - slot id
2742 // r5 - vector 2742 // r5 - vector
2743 Label miss; 2743 // r7 - allocation site (loaded from vector[slot])
2744 int argc = arg_count(); 2744 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r8);
2745 ParameterCount actual(argc); 2745 __ cmp(r4, r8);
2746 2746 __ bne(miss);
2747 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r7);
2748 __ cmp(r4, r7);
2749 __ bne(&miss);
2750 2747
2751 __ mov(r3, Operand(arg_count())); 2748 __ mov(r3, Operand(arg_count()));
2752 __ SmiToPtrArrayOffset(r9, r6);
2753 __ add(r9, r5, r9);
2754 __ LoadP(r7, FieldMemOperand(r9, FixedArray::kHeaderSize));
2755
2756 // Verify that r7 contains an AllocationSite
2757 __ LoadP(r8, FieldMemOperand(r7, HeapObject::kMapOffset));
2758 __ CompareRoot(r8, Heap::kAllocationSiteMapRootIndex);
2759 __ bne(&miss);
2760 2749
2761 // Increment the call count for monomorphic function calls. 2750 // Increment the call count for monomorphic function calls.
2762 const int count_offset = FixedArray::kHeaderSize + kPointerSize; 2751 const int count_offset = FixedArray::kHeaderSize + kPointerSize;
2763 __ LoadP(r6, FieldMemOperand(r9, count_offset)); 2752 __ SmiToPtrArrayOffset(r8, r6);
2753 __ add(r5, r5, r8);
2754 __ LoadP(r6, FieldMemOperand(r5, count_offset));
2764 __ AddSmiLiteral(r6, r6, Smi::FromInt(CallICNexus::kCallCountIncrement), r0); 2755 __ AddSmiLiteral(r6, r6, Smi::FromInt(CallICNexus::kCallCountIncrement), r0);
2765 __ StoreP(r6, FieldMemOperand(r9, count_offset), r0); 2756 __ StoreP(r6, FieldMemOperand(r5, count_offset), r0);
2766 2757
2767 __ mr(r5, r7); 2758 __ mr(r5, r7);
2768 __ mr(r6, r4); 2759 __ mr(r6, r4);
2769 ArrayConstructorStub stub(masm->isolate(), arg_count()); 2760 ArrayConstructorStub stub(masm->isolate(), arg_count());
2770 __ TailCallStub(&stub); 2761 __ TailCallStub(&stub);
2771
2772 __ bind(&miss);
2773 GenerateMiss(masm);
2774
2775 // The slow case, we need this no matter what to complete a call after a miss.
2776 __ mov(r3, Operand(arg_count()));
2777 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
2778 } 2762 }
2779 2763
2780 2764
2781 void CallICStub::Generate(MacroAssembler* masm) { 2765 void CallICStub::Generate(MacroAssembler* masm) {
2782 // r4 - function 2766 // r4 - function
2783 // r6 - slot id (Smi) 2767 // r6 - slot id (Smi)
2784 // r5 - vector 2768 // r5 - vector
2785 const int with_types_offset = 2769 const int with_types_offset =
2786 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); 2770 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex);
2787 const int generic_offset = 2771 const int generic_offset =
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2842 2826
2843 __ bind(&slow); 2827 __ bind(&slow);
2844 EmitSlowCase(masm, argc); 2828 EmitSlowCase(masm, argc);
2845 2829
2846 if (CallAsMethod()) { 2830 if (CallAsMethod()) {
2847 __ bind(&wrap); 2831 __ bind(&wrap);
2848 EmitWrapCase(masm, argc, &cont); 2832 EmitWrapCase(masm, argc, &cont);
2849 } 2833 }
2850 2834
2851 __ bind(&extra_checks_or_miss); 2835 __ bind(&extra_checks_or_miss);
2852 Label uninitialized, miss; 2836 Label uninitialized, miss, not_allocation_site;
2853 2837
2854 __ CompareRoot(r7, Heap::kmegamorphic_symbolRootIndex); 2838 __ CompareRoot(r7, Heap::kmegamorphic_symbolRootIndex);
2855 __ beq(&slow_start); 2839 __ beq(&slow_start);
2856 2840
2841 // Verify that r7 contains an AllocationSite
2842 __ LoadP(r8, FieldMemOperand(r7, HeapObject::kMapOffset));
2843 __ CompareRoot(r8, Heap::kAllocationSiteMapRootIndex);
2844 __ bne(&not_allocation_site);
2845
2846 // We have an allocation site.
2847 HandleArrayCase(masm, &miss);
2848
2849 __ bind(&not_allocation_site);
2850
2857 // The following cases attempt to handle MISS cases without going to the 2851 // The following cases attempt to handle MISS cases without going to the
2858 // runtime. 2852 // runtime.
2859 if (FLAG_trace_ic) { 2853 if (FLAG_trace_ic) {
2860 __ b(&miss); 2854 __ b(&miss);
2861 } 2855 }
2862 2856
2863 __ CompareRoot(r7, Heap::kuninitialized_symbolRootIndex); 2857 __ CompareRoot(r7, Heap::kuninitialized_symbolRootIndex);
2864 __ beq(&uninitialized); 2858 __ beq(&uninitialized);
2865 2859
2866 // We are going megamorphic. If the feedback is a JSFunction, it is fine 2860 // We are going megamorphic. If the feedback is a JSFunction, it is fine
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
2935 } 2929 }
2936 2930
2937 2931
2938 void CallICStub::GenerateMiss(MacroAssembler* masm) { 2932 void CallICStub::GenerateMiss(MacroAssembler* masm) {
2939 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 2933 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
2940 2934
2941 // Push the function and feedback info. 2935 // Push the function and feedback info.
2942 __ Push(r4, r5, r6); 2936 __ Push(r4, r5, r6);
2943 2937
2944 // Call the entry. 2938 // Call the entry.
2945 Runtime::FunctionId id = GetICState() == DEFAULT 2939 __ CallRuntime(Runtime::kCallIC_Miss, 3);
2946 ? Runtime::kCallIC_Miss
2947 : Runtime::kCallIC_Customization_Miss;
2948 __ CallRuntime(id, 3);
2949 2940
2950 // Move result to r4 and exit the internal frame. 2941 // Move result to r4 and exit the internal frame.
2951 __ mr(r4, r3); 2942 __ mr(r4, r3);
2952 } 2943 }
2953 2944
2954 2945
2955 // StringCharCodeAtGenerator 2946 // StringCharCodeAtGenerator
2956 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { 2947 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) {
2957 // If the receiver is a smi trigger the non-string case. 2948 // If the receiver is a smi trigger the non-string case.
2958 if (check_mode_ == RECEIVER_IS_UNKNOWN) { 2949 if (check_mode_ == RECEIVER_IS_UNKNOWN) {
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after
4499 } 4490 }
4500 4491
4501 4492
4502 void CallICTrampolineStub::Generate(MacroAssembler* masm) { 4493 void CallICTrampolineStub::Generate(MacroAssembler* masm) {
4503 EmitLoadTypeFeedbackVector(masm, r5); 4494 EmitLoadTypeFeedbackVector(masm, r5);
4504 CallICStub stub(isolate(), state()); 4495 CallICStub stub(isolate(), state());
4505 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); 4496 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
4506 } 4497 }
4507 4498
4508 4499
4509 void CallIC_ArrayTrampolineStub::Generate(MacroAssembler* masm) {
4510 EmitLoadTypeFeedbackVector(masm, r5);
4511 CallIC_ArrayStub stub(isolate(), state());
4512 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
4513 }
4514
4515
4516 void LoadICStub::Generate(MacroAssembler* masm) { GenerateImpl(masm, false); } 4500 void LoadICStub::Generate(MacroAssembler* masm) { GenerateImpl(masm, false); }
4517 4501
4518 4502
4519 void LoadICStub::GenerateForTrampoline(MacroAssembler* masm) { 4503 void LoadICStub::GenerateForTrampoline(MacroAssembler* masm) {
4520 GenerateImpl(masm, true); 4504 GenerateImpl(masm, true);
4521 } 4505 }
4522 4506
4523 4507
4524 static void HandleArrayCases(MacroAssembler* masm, Register feedback, 4508 static void HandleArrayCases(MacroAssembler* masm, Register feedback,
4525 Register receiver_map, Register scratch1, 4509 Register receiver_map, Register scratch1,
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after
5700 kStackUnwindSpace, NULL, 5684 kStackUnwindSpace, NULL,
5701 MemOperand(fp, 6 * kPointerSize), NULL); 5685 MemOperand(fp, 6 * kPointerSize), NULL);
5702 } 5686 }
5703 5687
5704 5688
5705 #undef __ 5689 #undef __
5706 } // namespace internal 5690 } // namespace internal
5707 } // namespace v8 5691 } // namespace v8
5708 5692
5709 #endif // V8_TARGET_ARCH_PPC 5693 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698