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

Side by Side Diff: src/mips64/builtins-mips64.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/mips/builtins-mips.cc ('k') | src/x64/builtins-x64.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_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
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 // -- a0 : number of arguments excluding receiver 21 // -- a0 : number of arguments excluding receiver
25 // -- a1 : target 22 // -- a1 : target
26 // -- a3 : new.target 23 // -- a3 : new.target
27 // -- sp[0] : last argument 24 // -- sp[0] : last argument
28 // -- ... 25 // -- ...
29 // -- sp[8 * (argc - 1)] : first argument 26 // -- sp[8 * (argc - 1)] : first argument
30 // -- sp[8 * agrc] : receiver 27 // -- sp[8 * agrc] : receiver
31 // ----------------------------------- 28 // -----------------------------------
32 __ AssertFunction(a1); 29 __ AssertFunction(a1);
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 __ ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 35 __ ld(cp, FieldMemOperand(a1, 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(a1, a3);
43 case BuiltinExtraArguments::kTarget:
44 __ Push(a1);
45 ++num_extra_args;
46 break;
47 case BuiltinExtraArguments::kNewTarget:
48 __ Push(a3);
49 ++num_extra_args;
50 break;
51 case BuiltinExtraArguments::kTargetAndNewTarget:
52 __ Push(a1, a3);
53 num_extra_args += 2;
54 break;
55 case BuiltinExtraArguments::kNone:
56 break;
57 }
58 40
59 // JumpToExternalReference expects a0 to contain the number of arguments 41 // JumpToExternalReference expects a0 to contain the number of arguments
60 // including the receiver and the extra arguments. 42 // including the receiver and the extra arguments.
61 __ Daddu(a0, a0, num_extra_args + 1); 43 __ Daddu(a0, a0, 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 2895 matching lines...) Expand 10 before | Expand all | Expand 10 after
2963 } 2945 }
2964 } 2946 }
2965 2947
2966 2948
2967 #undef __ 2949 #undef __
2968 2950
2969 } // namespace internal 2951 } // namespace internal
2970 } // namespace v8 2952 } // namespace v8
2971 2953
2972 #endif // V8_TARGET_ARCH_MIPS64 2954 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698