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

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

Issue 1442643009: Rename original constructor to new target (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 years, 1 month 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/arm64/builtins-arm64.cc ('k') | src/arm64/interface-descriptors-arm64.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 #if V8_TARGET_ARCH_ARM64 5 #if V8_TARGET_ARCH_ARM64
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/ic/handler-compiler.h" 10 #include "src/ic/handler-compiler.h"
(...skipping 2604 matching lines...) Expand 10 before | Expand all | Expand 10 after
2615 UntagSmiFieldMemOperand(subject, SlicedString::kOffsetOffset)); 2615 UntagSmiFieldMemOperand(subject, SlicedString::kOffsetOffset));
2616 __ Ldr(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); 2616 __ Ldr(subject, FieldMemOperand(subject, SlicedString::kParentOffset));
2617 __ B(&check_underlying); // Go to (4). 2617 __ B(&check_underlying); // Go to (4).
2618 #endif 2618 #endif
2619 } 2619 }
2620 2620
2621 2621
2622 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub, 2622 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub,
2623 Register argc, Register function, 2623 Register argc, Register function,
2624 Register feedback_vector, Register index, 2624 Register feedback_vector, Register index,
2625 Register orig_construct, bool is_super) { 2625 Register new_target, bool is_super) {
2626 FrameScope scope(masm, StackFrame::INTERNAL); 2626 FrameScope scope(masm, StackFrame::INTERNAL);
2627 2627
2628 // Number-of-arguments register must be smi-tagged to call out. 2628 // Number-of-arguments register must be smi-tagged to call out.
2629 __ SmiTag(argc); 2629 __ SmiTag(argc);
2630 if (is_super) { 2630 if (is_super) {
2631 __ Push(argc, function, feedback_vector, index, orig_construct); 2631 __ Push(argc, function, feedback_vector, index, new_target);
2632 } else { 2632 } else {
2633 __ Push(argc, function, feedback_vector, index); 2633 __ Push(argc, function, feedback_vector, index);
2634 } 2634 }
2635 2635
2636 DCHECK(feedback_vector.Is(x2) && index.Is(x3)); 2636 DCHECK(feedback_vector.Is(x2) && index.Is(x3));
2637 __ CallStub(stub); 2637 __ CallStub(stub);
2638 2638
2639 if (is_super) { 2639 if (is_super) {
2640 __ Pop(orig_construct, index, feedback_vector, function, argc); 2640 __ Pop(new_target, index, feedback_vector, function, argc);
2641 } else { 2641 } else {
2642 __ Pop(index, feedback_vector, function, argc); 2642 __ Pop(index, feedback_vector, function, argc);
2643 } 2643 }
2644 __ SmiUntag(argc); 2644 __ SmiUntag(argc);
2645 } 2645 }
2646 2646
2647 2647
2648 static void GenerateRecordCallTarget(MacroAssembler* masm, Register argc, 2648 static void GenerateRecordCallTarget(MacroAssembler* masm, Register argc,
2649 Register function, 2649 Register function,
2650 Register feedback_vector, Register index, 2650 Register feedback_vector, Register index,
2651 Register orig_construct, Register scratch1, 2651 Register new_target, Register scratch1,
2652 Register scratch2, Register scratch3, 2652 Register scratch2, Register scratch3,
2653 bool is_super) { 2653 bool is_super) {
2654 ASM_LOCATION("GenerateRecordCallTarget"); 2654 ASM_LOCATION("GenerateRecordCallTarget");
2655 DCHECK(!AreAliased(scratch1, scratch2, scratch3, argc, function, 2655 DCHECK(!AreAliased(scratch1, scratch2, scratch3, argc, function,
2656 feedback_vector, index, orig_construct)); 2656 feedback_vector, index, new_target));
2657 // Cache the called function in a feedback vector slot. Cache states are 2657 // Cache the called function in a feedback vector slot. Cache states are
2658 // uninitialized, monomorphic (indicated by a JSFunction), and megamorphic. 2658 // uninitialized, monomorphic (indicated by a JSFunction), and megamorphic.
2659 // argc : number of arguments to the construct function 2659 // argc : number of arguments to the construct function
2660 // function : the function to call 2660 // function : the function to call
2661 // feedback_vector : the feedback vector 2661 // feedback_vector : the feedback vector
2662 // index : slot in feedback vector (smi) 2662 // index : slot in feedback vector (smi)
2663 // orig_construct : original constructor (for IsSuperConstructorCall) 2663 // new_target : new target (for IsSuperConstructorCall)
2664 Label initialize, done, miss, megamorphic, not_array_function; 2664 Label initialize, done, miss, megamorphic, not_array_function;
2665 2665
2666 DCHECK_EQ(*TypeFeedbackVector::MegamorphicSentinel(masm->isolate()), 2666 DCHECK_EQ(*TypeFeedbackVector::MegamorphicSentinel(masm->isolate()),
2667 masm->isolate()->heap()->megamorphic_symbol()); 2667 masm->isolate()->heap()->megamorphic_symbol());
2668 DCHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(masm->isolate()), 2668 DCHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(masm->isolate()),
2669 masm->isolate()->heap()->uninitialized_symbol()); 2669 masm->isolate()->heap()->uninitialized_symbol());
2670 2670
2671 // Load the cache state. 2671 // Load the cache state.
2672 Register feedback = scratch1; 2672 Register feedback = scratch1;
2673 Register feedback_map = scratch2; 2673 Register feedback_map = scratch2;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
2729 // Make sure the function is the Array() function 2729 // Make sure the function is the Array() function
2730 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, scratch1); 2730 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, scratch1);
2731 __ Cmp(function, scratch1); 2731 __ Cmp(function, scratch1);
2732 __ B(ne, &not_array_function); 2732 __ B(ne, &not_array_function);
2733 2733
2734 // The target function is the Array constructor, 2734 // The target function is the Array constructor,
2735 // Create an AllocationSite if we don't already have it, store it in the 2735 // Create an AllocationSite if we don't already have it, store it in the
2736 // slot. 2736 // slot.
2737 CreateAllocationSiteStub create_stub(masm->isolate()); 2737 CreateAllocationSiteStub create_stub(masm->isolate());
2738 CallStubInRecordCallTarget(masm, &create_stub, argc, function, 2738 CallStubInRecordCallTarget(masm, &create_stub, argc, function,
2739 feedback_vector, index, orig_construct, is_super); 2739 feedback_vector, index, new_target, is_super);
2740 __ B(&done); 2740 __ B(&done);
2741 2741
2742 __ Bind(&not_array_function); 2742 __ Bind(&not_array_function);
2743 CreateWeakCellStub weak_cell_stub(masm->isolate()); 2743 CreateWeakCellStub weak_cell_stub(masm->isolate());
2744 CallStubInRecordCallTarget(masm, &weak_cell_stub, argc, function, 2744 CallStubInRecordCallTarget(masm, &weak_cell_stub, argc, function,
2745 feedback_vector, index, orig_construct, is_super); 2745 feedback_vector, index, new_target, is_super);
2746 __ Bind(&done); 2746 __ Bind(&done);
2747 } 2747 }
2748 2748
2749 2749
2750 void CallConstructStub::Generate(MacroAssembler* masm) { 2750 void CallConstructStub::Generate(MacroAssembler* masm) {
2751 ASM_LOCATION("CallConstructStub::Generate"); 2751 ASM_LOCATION("CallConstructStub::Generate");
2752 // x0 : number of arguments 2752 // x0 : number of arguments
2753 // x1 : the function to call 2753 // x1 : the function to call
2754 // x2 : feedback vector 2754 // x2 : feedback vector
2755 // x3 : slot in feedback vector (Smi, for RecordCallTarget) 2755 // x3 : slot in feedback vector (Smi, for RecordCallTarget)
2756 // x4 : original constructor (for IsSuperConstructorCall) 2756 // x4 : new target (for IsSuperConstructorCall)
2757 Register function = x1; 2757 Register function = x1;
2758 2758
2759 Label non_function; 2759 Label non_function;
2760 // Check that the function is not a smi. 2760 // Check that the function is not a smi.
2761 __ JumpIfSmi(function, &non_function); 2761 __ JumpIfSmi(function, &non_function);
2762 // Check that the function is a JSFunction. 2762 // Check that the function is a JSFunction.
2763 Register object_type = x10; 2763 Register object_type = x10;
2764 __ JumpIfNotObjectType(function, object_type, object_type, JS_FUNCTION_TYPE, 2764 __ JumpIfNotObjectType(function, object_type, object_type, JS_FUNCTION_TYPE,
2765 &non_function); 2765 &non_function);
2766 2766
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2821 __ Add(feedback_vector, feedback_vector, 2821 __ Add(feedback_vector, feedback_vector,
2822 Operand::UntagSmiAndScale(index, kPointerSizeLog2)); 2822 Operand::UntagSmiAndScale(index, kPointerSizeLog2));
2823 __ Add(feedback_vector, feedback_vector, 2823 __ Add(feedback_vector, feedback_vector,
2824 Operand(FixedArray::kHeaderSize + kPointerSize)); 2824 Operand(FixedArray::kHeaderSize + kPointerSize));
2825 __ Ldr(index, FieldMemOperand(feedback_vector, 0)); 2825 __ Ldr(index, FieldMemOperand(feedback_vector, 0));
2826 __ Add(index, index, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); 2826 __ Add(index, index, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement)));
2827 __ Str(index, FieldMemOperand(feedback_vector, 0)); 2827 __ Str(index, FieldMemOperand(feedback_vector, 0));
2828 2828
2829 // Set up arguments for the array constructor stub. 2829 // Set up arguments for the array constructor stub.
2830 Register allocation_site_arg = feedback_vector; 2830 Register allocation_site_arg = feedback_vector;
2831 Register original_constructor_arg = index; 2831 Register new_target_arg = index;
2832 __ Mov(allocation_site_arg, allocation_site); 2832 __ Mov(allocation_site_arg, allocation_site);
2833 __ Mov(original_constructor_arg, function); 2833 __ Mov(new_target_arg, function);
2834 ArrayConstructorStub stub(masm->isolate(), arg_count()); 2834 ArrayConstructorStub stub(masm->isolate(), arg_count());
2835 __ TailCallStub(&stub); 2835 __ TailCallStub(&stub);
2836 } 2836 }
2837 2837
2838 2838
2839 void CallICStub::Generate(MacroAssembler* masm) { 2839 void CallICStub::Generate(MacroAssembler* masm) {
2840 ASM_LOCATION("CallICStub"); 2840 ASM_LOCATION("CallICStub");
2841 2841
2842 // x1 - function 2842 // x1 - function
2843 // x3 - slot id (Smi) 2843 // x3 - slot id (Smi)
(...skipping 2387 matching lines...) Expand 10 before | Expand all | Expand 10 after
5231 } 5231 }
5232 } 5232 }
5233 5233
5234 5234
5235 void ArrayConstructorStub::Generate(MacroAssembler* masm) { 5235 void ArrayConstructorStub::Generate(MacroAssembler* masm) {
5236 ASM_LOCATION("ArrayConstructorStub::Generate"); 5236 ASM_LOCATION("ArrayConstructorStub::Generate");
5237 // ----------- S t a t e ------------- 5237 // ----------- S t a t e -------------
5238 // -- x0 : argc (only if argument_count() is ANY or MORE_THAN_ONE) 5238 // -- x0 : argc (only if argument_count() is ANY or MORE_THAN_ONE)
5239 // -- x1 : constructor 5239 // -- x1 : constructor
5240 // -- x2 : AllocationSite or undefined 5240 // -- x2 : AllocationSite or undefined
5241 // -- x3 : original constructor 5241 // -- x3 : new target
5242 // -- sp[0] : last argument 5242 // -- sp[0] : last argument
5243 // ----------------------------------- 5243 // -----------------------------------
5244 Register constructor = x1; 5244 Register constructor = x1;
5245 Register allocation_site = x2; 5245 Register allocation_site = x2;
5246 Register original_constructor = x3; 5246 Register new_target = x3;
5247 5247
5248 if (FLAG_debug_code) { 5248 if (FLAG_debug_code) {
5249 // The array construct code is only set for the global and natives 5249 // The array construct code is only set for the global and natives
5250 // builtin Array functions which always have maps. 5250 // builtin Array functions which always have maps.
5251 5251
5252 Label unexpected_map, map_ok; 5252 Label unexpected_map, map_ok;
5253 // Initial map for the builtin Array function should be a map. 5253 // Initial map for the builtin Array function should be a map.
5254 __ Ldr(x10, FieldMemOperand(constructor, 5254 __ Ldr(x10, FieldMemOperand(constructor,
5255 JSFunction::kPrototypeOrInitialMapOffset)); 5255 JSFunction::kPrototypeOrInitialMapOffset));
5256 // Will both indicate a NULL and a Smi. 5256 // Will both indicate a NULL and a Smi.
5257 __ JumpIfSmi(x10, &unexpected_map); 5257 __ JumpIfSmi(x10, &unexpected_map);
5258 __ JumpIfObjectType(x10, x10, x11, MAP_TYPE, &map_ok); 5258 __ JumpIfObjectType(x10, x10, x11, MAP_TYPE, &map_ok);
5259 __ Bind(&unexpected_map); 5259 __ Bind(&unexpected_map);
5260 __ Abort(kUnexpectedInitialMapForArrayFunction); 5260 __ Abort(kUnexpectedInitialMapForArrayFunction);
5261 __ Bind(&map_ok); 5261 __ Bind(&map_ok);
5262 5262
5263 // We should either have undefined in the allocation_site register or a 5263 // We should either have undefined in the allocation_site register or a
5264 // valid AllocationSite. 5264 // valid AllocationSite.
5265 __ AssertUndefinedOrAllocationSite(allocation_site, x10); 5265 __ AssertUndefinedOrAllocationSite(allocation_site, x10);
5266 } 5266 }
5267 5267
5268 Label subclassing; 5268 Label subclassing;
5269 __ Cmp(original_constructor, constructor); 5269 __ Cmp(new_target, constructor);
5270 __ B(ne, &subclassing); 5270 __ B(ne, &subclassing);
5271 5271
5272 Register kind = x3; 5272 Register kind = x3;
5273 Label no_info; 5273 Label no_info;
5274 // Get the elements kind and case on that. 5274 // Get the elements kind and case on that.
5275 __ JumpIfRoot(allocation_site, Heap::kUndefinedValueRootIndex, &no_info); 5275 __ JumpIfRoot(allocation_site, Heap::kUndefinedValueRootIndex, &no_info);
5276 5276
5277 __ Ldrsw(kind, 5277 __ Ldrsw(kind,
5278 UntagSmiFieldMemOperand(allocation_site, 5278 UntagSmiFieldMemOperand(allocation_site,
5279 AllocationSite::kTransitionInfoOffset)); 5279 AllocationSite::kTransitionInfoOffset));
5280 __ And(kind, kind, AllocationSite::ElementsKindBits::kMask); 5280 __ And(kind, kind, AllocationSite::ElementsKindBits::kMask);
5281 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); 5281 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE);
5282 5282
5283 __ Bind(&no_info); 5283 __ Bind(&no_info);
5284 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); 5284 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);
5285 5285
5286 // Subclassing support. 5286 // Subclassing support.
5287 __ Bind(&subclassing); 5287 __ Bind(&subclassing);
5288 __ Push(constructor, original_constructor); 5288 __ Push(constructor, new_target);
5289 // Adjust argc. 5289 // Adjust argc.
5290 switch (argument_count()) { 5290 switch (argument_count()) {
5291 case ANY: 5291 case ANY:
5292 case MORE_THAN_ONE: 5292 case MORE_THAN_ONE:
5293 __ add(x0, x0, Operand(2)); 5293 __ add(x0, x0, Operand(2));
5294 break; 5294 break;
5295 case NONE: 5295 case NONE:
5296 __ Mov(x0, Operand(2)); 5296 __ Mov(x0, Operand(2));
5297 break; 5297 break;
5298 case ONE: 5298 case ONE:
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
5884 MemOperand(fp, 6 * kPointerSize), NULL); 5884 MemOperand(fp, 6 * kPointerSize), NULL);
5885 } 5885 }
5886 5886
5887 5887
5888 #undef __ 5888 #undef __
5889 5889
5890 } // namespace internal 5890 } // namespace internal
5891 } // namespace v8 5891 } // namespace v8
5892 5892
5893 #endif // V8_TARGET_ARCH_ARM64 5893 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm64/builtins-arm64.cc ('k') | src/arm64/interface-descriptors-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698