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

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

Issue 1510273002: PPC: Type Feedback Vector: Calculate profiler counts on the fly. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 2581 matching lines...) Expand 10 before | Expand all | Expand 10 after
2592 __ mr(r6, r4); 2592 __ mr(r6, r4);
2593 ArrayConstructorStub stub(masm->isolate(), arg_count()); 2593 ArrayConstructorStub stub(masm->isolate(), arg_count());
2594 __ TailCallStub(&stub); 2594 __ TailCallStub(&stub);
2595 } 2595 }
2596 2596
2597 2597
2598 void CallICStub::Generate(MacroAssembler* masm) { 2598 void CallICStub::Generate(MacroAssembler* masm) {
2599 // r4 - function 2599 // r4 - function
2600 // r6 - slot id (Smi) 2600 // r6 - slot id (Smi)
2601 // r5 - vector 2601 // r5 - vector
2602 const int with_types_offset =
2603 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex);
2604 const int generic_offset =
2605 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex);
2606 Label extra_checks_or_miss, call, call_function; 2602 Label extra_checks_or_miss, call, call_function;
2607 int argc = arg_count(); 2603 int argc = arg_count();
2608 ParameterCount actual(argc); 2604 ParameterCount actual(argc);
2609 2605
2610 // The checks. First, does r4 match the recorded monomorphic target? 2606 // The checks. First, does r4 match the recorded monomorphic target?
2611 __ SmiToPtrArrayOffset(r9, r6); 2607 __ SmiToPtrArrayOffset(r9, r6);
2612 __ add(r9, r5, r9); 2608 __ add(r9, r5, r9);
2613 __ LoadP(r7, FieldMemOperand(r9, FixedArray::kHeaderSize)); 2609 __ LoadP(r7, FieldMemOperand(r9, FixedArray::kHeaderSize));
2614 2610
2615 // We don't know that we have a weak cell. We might have a private symbol 2611 // We don't know that we have a weak cell. We might have a private symbol
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2670 __ CompareRoot(r7, Heap::kuninitialized_symbolRootIndex); 2666 __ CompareRoot(r7, Heap::kuninitialized_symbolRootIndex);
2671 __ beq(&uninitialized); 2667 __ beq(&uninitialized);
2672 2668
2673 // We are going megamorphic. If the feedback is a JSFunction, it is fine 2669 // We are going megamorphic. If the feedback is a JSFunction, it is fine
2674 // to handle it here. More complex cases are dealt with in the runtime. 2670 // to handle it here. More complex cases are dealt with in the runtime.
2675 __ AssertNotSmi(r7); 2671 __ AssertNotSmi(r7);
2676 __ CompareObjectType(r7, r8, r8, JS_FUNCTION_TYPE); 2672 __ CompareObjectType(r7, r8, r8, JS_FUNCTION_TYPE);
2677 __ bne(&miss); 2673 __ bne(&miss);
2678 __ LoadRoot(ip, Heap::kmegamorphic_symbolRootIndex); 2674 __ LoadRoot(ip, Heap::kmegamorphic_symbolRootIndex);
2679 __ StoreP(ip, FieldMemOperand(r9, FixedArray::kHeaderSize), r0); 2675 __ StoreP(ip, FieldMemOperand(r9, FixedArray::kHeaderSize), r0);
2680 // We have to update statistics for runtime profiling.
2681 __ LoadP(r7, FieldMemOperand(r5, with_types_offset));
2682 __ SubSmiLiteral(r7, r7, Smi::FromInt(1), r0);
2683 __ StoreP(r7, FieldMemOperand(r5, with_types_offset), r0);
2684 __ LoadP(r7, FieldMemOperand(r5, generic_offset));
2685 __ AddSmiLiteral(r7, r7, Smi::FromInt(1), r0);
2686 __ StoreP(r7, FieldMemOperand(r5, generic_offset), r0);
2687 2676
2688 __ bind(&call); 2677 __ bind(&call);
2689 __ mov(r3, Operand(argc)); 2678 __ mov(r3, Operand(argc));
2690 __ Jump(masm->isolate()->builtins()->Call(convert_mode()), 2679 __ Jump(masm->isolate()->builtins()->Call(convert_mode()),
2691 RelocInfo::CODE_TARGET); 2680 RelocInfo::CODE_TARGET);
2692 2681
2693 __ bind(&uninitialized); 2682 __ bind(&uninitialized);
2694 2683
2695 // We are going monomorphic, provided we actually have a JSFunction. 2684 // We are going monomorphic, provided we actually have a JSFunction.
2696 __ JumpIfSmi(r4, &miss); 2685 __ JumpIfSmi(r4, &miss);
2697 2686
2698 // Goto miss case if we do not have a function. 2687 // Goto miss case if we do not have a function.
2699 __ CompareObjectType(r4, r7, r7, JS_FUNCTION_TYPE); 2688 __ CompareObjectType(r4, r7, r7, JS_FUNCTION_TYPE);
2700 __ bne(&miss); 2689 __ bne(&miss);
2701 2690
2702 // Make sure the function is not the Array() function, which requires special 2691 // Make sure the function is not the Array() function, which requires special
2703 // behavior on MISS. 2692 // behavior on MISS.
2704 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r7); 2693 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r7);
2705 __ cmp(r4, r7); 2694 __ cmp(r4, r7);
2706 __ beq(&miss); 2695 __ beq(&miss);
2707 2696
2708 // Make sure the function belongs to the same native context. 2697 // Make sure the function belongs to the same native context.
2709 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kContextOffset)); 2698 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kContextOffset));
2710 __ LoadP(r7, ContextMemOperand(r7, Context::NATIVE_CONTEXT_INDEX)); 2699 __ LoadP(r7, ContextMemOperand(r7, Context::NATIVE_CONTEXT_INDEX));
2711 __ LoadP(ip, NativeContextMemOperand()); 2700 __ LoadP(ip, NativeContextMemOperand());
2712 __ cmp(r7, ip); 2701 __ cmp(r7, ip);
2713 __ bne(&miss); 2702 __ bne(&miss);
2714 2703
2715 // Update stats.
2716 __ LoadP(r7, FieldMemOperand(r5, with_types_offset));
2717 __ AddSmiLiteral(r7, r7, Smi::FromInt(1), r0);
2718 __ StoreP(r7, FieldMemOperand(r5, with_types_offset), r0);
2719
2720 // Initialize the call counter. 2704 // Initialize the call counter.
2721 __ LoadSmiLiteral(r8, Smi::FromInt(CallICNexus::kCallCountIncrement)); 2705 __ LoadSmiLiteral(r8, Smi::FromInt(CallICNexus::kCallCountIncrement));
2722 __ StoreP(r8, FieldMemOperand(r9, count_offset), r0); 2706 __ StoreP(r8, FieldMemOperand(r9, count_offset), r0);
2723 2707
2724 // Store the function. Use a stub since we need a frame for allocation. 2708 // Store the function. Use a stub since we need a frame for allocation.
2725 // r5 - vector 2709 // r5 - vector
2726 // r6 - slot 2710 // r6 - slot
2727 // r4 - function 2711 // r4 - function
2728 { 2712 {
2729 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 2713 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
(...skipping 2924 matching lines...) Expand 10 before | Expand all | Expand 10 after
5654 kStackUnwindSpace, NULL, 5638 kStackUnwindSpace, NULL,
5655 MemOperand(fp, 6 * kPointerSize), NULL); 5639 MemOperand(fp, 6 * kPointerSize), NULL);
5656 } 5640 }
5657 5641
5658 5642
5659 #undef __ 5643 #undef __
5660 } // namespace internal 5644 } // namespace internal
5661 } // namespace v8 5645 } // namespace v8
5662 5646
5663 #endif // V8_TARGET_ARCH_PPC 5647 #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