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

Side by Side Diff: src/arm/builtins-arm.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 | « no previous file | src/arm64/builtins-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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_ARM 5 #if V8_TARGET_ARCH_ARM
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
11 #include "src/runtime/runtime.h" 11 #include "src/runtime/runtime.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 15
16 16
17 #define __ ACCESS_MASM(masm) 17 #define __ ACCESS_MASM(masm)
18 18
19 19 void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id) {
20 void Builtins::Generate_Adaptor(MacroAssembler* masm,
21 CFunctionId id,
22 BuiltinExtraArguments extra_args) {
23 // ----------- S t a t e ------------- 20 // ----------- S t a t e -------------
24 // -- r0 : number of arguments excluding receiver 21 // -- r0 : number of arguments excluding receiver
25 // -- r1 : target 22 // -- r1 : target
26 // -- r3 : new.target 23 // -- r3 : new.target
27 // -- sp[0] : last argument 24 // -- sp[0] : last argument
28 // -- ... 25 // -- ...
29 // -- sp[4 * (argc - 1)] : first argument 26 // -- sp[4 * (argc - 1)] : first argument
30 // -- sp[4 * argc] : receiver 27 // -- sp[4 * argc] : receiver
31 // ----------------------------------- 28 // -----------------------------------
32 __ AssertFunction(r1); 29 __ AssertFunction(r1);
33 30
34 // Make sure we operate in the context of the called function (for example 31 // Make sure we operate in the context of the called function (for example
35 // ConstructStubs implemented in C++ will be run in the context of the caller 32 // ConstructStubs implemented in C++ will be run in the context of the caller
36 // instead of the callee, due to the way that [[Construct]] is defined for 33 // instead of the callee, due to the way that [[Construct]] is defined for
37 // ordinary functions). 34 // ordinary functions).
38 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); 35 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
39 36
40 // Insert extra arguments. 37 // Insert extra arguments.
41 int num_extra_args = 0; 38 const int num_extra_args = 2;
42 switch (extra_args) { 39 __ Push(r1, r3);
43 case BuiltinExtraArguments::kTarget:
44 __ Push(r1);
45 ++num_extra_args;
46 break;
47 case BuiltinExtraArguments::kNewTarget:
48 __ Push(r3);
49 ++num_extra_args;
50 break;
51 case BuiltinExtraArguments::kTargetAndNewTarget:
52 __ Push(r1, r3);
53 num_extra_args += 2;
54 break;
55 case BuiltinExtraArguments::kNone:
56 break;
57 }
58 40
59 // JumpToExternalReference expects r0 to contain the number of arguments 41 // JumpToExternalReference expects r0 to contain the number of arguments
60 // including the receiver and the extra arguments. 42 // including the receiver and the extra arguments.
61 __ add(r0, r0, Operand(num_extra_args + 1)); 43 __ add(r0, r0, Operand(num_extra_args + 1));
62 44
63 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); 45 __ JumpToExternalReference(ExternalReference(id, masm->isolate()));
64 } 46 }
65 47
66 48
67 // Load the built-in InternalArray function from the current context. 49 // Load the built-in InternalArray function from the current context.
(...skipping 2813 matching lines...) Expand 10 before | Expand all | Expand 10 after
2881 } 2863 }
2882 } 2864 }
2883 2865
2884 2866
2885 #undef __ 2867 #undef __
2886 2868
2887 } // namespace internal 2869 } // namespace internal
2888 } // namespace v8 2870 } // namespace v8
2889 2871
2890 #endif // V8_TARGET_ARCH_ARM 2872 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/builtins-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698