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

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

Issue 1057613003: Code cleanup in GenerateRecordCallTarget. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Slight comment improvement. Created 5 years, 8 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 | « src/arm/code-stubs-arm.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM64 7 #if V8_TARGET_ARCH_ARM64
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 2718 matching lines...) Expand 10 before | Expand all | Expand 10 after
2729 #endif 2729 #endif
2730 } 2730 }
2731 2731
2732 2732
2733 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub, 2733 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub,
2734 Register argc, Register function, 2734 Register argc, Register function,
2735 Register feedback_vector, 2735 Register feedback_vector,
2736 Register index) { 2736 Register index) {
2737 FrameScope scope(masm, StackFrame::INTERNAL); 2737 FrameScope scope(masm, StackFrame::INTERNAL);
2738 2738
2739 // Arguments register must be smi-tagged to call out. 2739 // Number-of-arguments register must be smi-tagged to call out.
2740 __ SmiTag(argc); 2740 __ SmiTag(argc);
2741 __ Push(argc, function, feedback_vector, index); 2741 __ Push(argc, function, feedback_vector, index);
2742 2742
2743 DCHECK(feedback_vector.Is(x2) && index.Is(x3)); 2743 DCHECK(feedback_vector.Is(x2) && index.Is(x3));
2744 __ CallStub(stub); 2744 __ CallStub(stub);
2745 2745
2746 __ Pop(index, feedback_vector, function, argc); 2746 __ Pop(index, feedback_vector, function, argc);
2747 __ SmiUntag(argc); 2747 __ SmiUntag(argc);
2748 } 2748 }
2749 2749
(...skipping 22 matching lines...) Expand all
2772 // Load the cache state. 2772 // Load the cache state.
2773 Register feedback = scratch1; 2773 Register feedback = scratch1;
2774 Register feedback_map = scratch2; 2774 Register feedback_map = scratch2;
2775 Register feedback_value = scratch3; 2775 Register feedback_value = scratch3;
2776 __ Add(feedback, feedback_vector, 2776 __ Add(feedback, feedback_vector,
2777 Operand::UntagSmiAndScale(index, kPointerSizeLog2)); 2777 Operand::UntagSmiAndScale(index, kPointerSizeLog2));
2778 __ Ldr(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize)); 2778 __ Ldr(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize));
2779 2779
2780 // A monomorphic cache hit or an already megamorphic state: invoke the 2780 // A monomorphic cache hit or an already megamorphic state: invoke the
2781 // function without changing the state. 2781 // function without changing the state.
2782 // We don't know if feedback value is a WeakCell or a Symbol, but it's
2783 // harmless to read at this position in a symbol (see static asserts in
2784 // type-feedback-vector.h).
2782 Label check_allocation_site; 2785 Label check_allocation_site;
2783 __ Ldr(feedback_value, FieldMemOperand(feedback, WeakCell::kValueOffset)); 2786 __ Ldr(feedback_value, FieldMemOperand(feedback, WeakCell::kValueOffset));
2784 __ Cmp(function, feedback_value); 2787 __ Cmp(function, feedback_value);
2785 __ B(eq, &done); 2788 __ B(eq, &done);
2786 __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex); 2789 __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex);
2787 __ B(eq, &done); 2790 __ B(eq, &done);
2788 __ Ldr(feedback_map, FieldMemOperand(feedback, 0)); 2791 __ Ldr(feedback_map, FieldMemOperand(feedback, HeapObject::kMapOffset));
2789 __ CompareRoot(feedback_map, Heap::kWeakCellMapRootIndex); 2792 __ CompareRoot(feedback_map, Heap::kWeakCellMapRootIndex);
2790 __ B(ne, FLAG_pretenuring_call_new ? &miss : &check_allocation_site); 2793 __ B(ne, FLAG_pretenuring_call_new ? &miss : &check_allocation_site);
2791 2794
2792 // If function is not equal to the weak cell value, and the weak cell value is 2795 // If the weak cell is cleared, we have a new chance to become monomorphic.
2793 // cleared, we have a new chance to become monomorphic.
2794 __ JumpIfSmi(feedback_value, &initialize); 2796 __ JumpIfSmi(feedback_value, &initialize);
2795 __ B(&megamorphic); 2797 __ B(&megamorphic);
2796 2798
2797 if (!FLAG_pretenuring_call_new) { 2799 if (!FLAG_pretenuring_call_new) {
2798 __ bind(&check_allocation_site); 2800 __ bind(&check_allocation_site);
2799 // If we came here, we need to see if we are the array function. 2801 // If we came here, we need to see if we are the array function.
2800 // If we didn't have a matching function, and we didn't find the megamorph 2802 // If we didn't have a matching function, and we didn't find the megamorph
2801 // sentinel, then we have in the slot either some other function or an 2803 // sentinel, then we have in the slot either some other function or an
2802 // AllocationSite. Do a map check on the object in scratch1 register. 2804 // AllocationSite.
2803 __ JumpIfNotRoot(feedback_map, Heap::kAllocationSiteMapRootIndex, &miss); 2805 __ JumpIfNotRoot(feedback_map, Heap::kAllocationSiteMapRootIndex, &miss);
2804 2806
2805 // Make sure the function is the Array() function 2807 // Make sure the function is the Array() function
2806 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, scratch1); 2808 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, scratch1);
2807 __ Cmp(function, scratch1); 2809 __ Cmp(function, scratch1);
2808 __ B(ne, &megamorphic); 2810 __ B(ne, &megamorphic);
2809 __ B(&done); 2811 __ B(&done);
2810 } 2812 }
2811 2813
2812 __ Bind(&miss); 2814 __ Bind(&miss);
(...skipping 2940 matching lines...) Expand 10 before | Expand all | Expand 10 after
5753 kStackUnwindSpace, NULL, spill_offset, 5755 kStackUnwindSpace, NULL, spill_offset,
5754 MemOperand(fp, 6 * kPointerSize), NULL); 5756 MemOperand(fp, 6 * kPointerSize), NULL);
5755 } 5757 }
5756 5758
5757 5759
5758 #undef __ 5760 #undef __
5759 5761
5760 } } // namespace v8::internal 5762 } } // namespace v8::internal
5761 5763
5762 #endif // V8_TARGET_ARCH_ARM64 5764 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698