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

Side by Side Diff: src/arm64/builtins-arm64.cc

Issue 2074063002: [builtins] Always pass target and new target to C++ builtins (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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/builtins-arm.cc ('k') | src/builtins.h » ('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/arm64/frames-arm64.h" 7 #include "src/arm64/frames-arm64.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 14 matching lines...) Expand all
25 } 25 }
26 26
27 27
28 // Load the built-in InternalArray function from the current context. 28 // Load the built-in InternalArray function from the current context.
29 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, 29 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm,
30 Register result) { 30 Register result) {
31 // Load the InternalArray function from the native context. 31 // Load the InternalArray function from the native context.
32 __ LoadNativeContextSlot(Context::INTERNAL_ARRAY_FUNCTION_INDEX, result); 32 __ LoadNativeContextSlot(Context::INTERNAL_ARRAY_FUNCTION_INDEX, result);
33 } 33 }
34 34
35 35 void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id) {
36 void Builtins::Generate_Adaptor(MacroAssembler* masm,
37 CFunctionId id,
38 BuiltinExtraArguments extra_args) {
39 // ----------- S t a t e ------------- 36 // ----------- S t a t e -------------
40 // -- x0 : number of arguments excluding receiver 37 // -- x0 : number of arguments excluding receiver
41 // -- x1 : target 38 // -- x1 : target
42 // -- x3 : new target 39 // -- x3 : new target
43 // -- sp[0] : last argument 40 // -- sp[0] : last argument
44 // -- ... 41 // -- ...
45 // -- sp[4 * (argc - 1)] : first argument 42 // -- sp[4 * (argc - 1)] : first argument
46 // -- sp[4 * argc] : receiver 43 // -- sp[4 * argc] : receiver
47 // ----------------------------------- 44 // -----------------------------------
48 __ AssertFunction(x1); 45 __ AssertFunction(x1);
49 46
50 // Make sure we operate in the context of the called function (for example 47 // Make sure we operate in the context of the called function (for example
51 // ConstructStubs implemented in C++ will be run in the context of the caller 48 // ConstructStubs implemented in C++ will be run in the context of the caller
52 // instead of the callee, due to the way that [[Construct]] is defined for 49 // instead of the callee, due to the way that [[Construct]] is defined for
53 // ordinary functions). 50 // ordinary functions).
54 __ Ldr(cp, FieldMemOperand(x1, JSFunction::kContextOffset)); 51 __ Ldr(cp, FieldMemOperand(x1, JSFunction::kContextOffset));
55 52
56 // Insert extra arguments. 53 // Insert extra arguments.
57 int num_extra_args = 0; 54 const int num_extra_args = 2;
58 switch (extra_args) { 55 __ Push(x1, x3);
59 case BuiltinExtraArguments::kTarget:
60 __ Push(x1);
61 ++num_extra_args;
62 break;
63 case BuiltinExtraArguments::kNewTarget:
64 __ Push(x3);
65 ++num_extra_args;
66 break;
67 case BuiltinExtraArguments::kTargetAndNewTarget:
68 __ Push(x1, x3);
69 num_extra_args += 2;
70 break;
71 case BuiltinExtraArguments::kNone:
72 break;
73 }
74 56
75 // JumpToExternalReference expects x0 to contain the number of arguments 57 // JumpToExternalReference expects x0 to contain the number of arguments
76 // including the receiver and the extra arguments. 58 // including the receiver and the extra arguments.
77 __ Add(x0, x0, num_extra_args + 1); 59 __ Add(x0, x0, num_extra_args + 1);
78 60
79 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); 61 __ JumpToExternalReference(ExternalReference(id, masm->isolate()));
80 } 62 }
81 63
82 64
83 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { 65 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) {
(...skipping 2920 matching lines...) Expand 10 before | Expand all | Expand 10 after
3004 } 2986 }
3005 } 2987 }
3006 2988
3007 2989
3008 #undef __ 2990 #undef __
3009 2991
3010 } // namespace internal 2992 } // namespace internal
3011 } // namespace v8 2993 } // namespace v8
3012 2994
3013 #endif // V8_TARGET_ARCH_ARM 2995 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698