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

Side by Side Diff: src/mips/builtins-mips.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/ia32/builtins-ia32.cc ('k') | src/mips64/builtins-mips64.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_MIPS 5 #if V8_TARGET_ARCH_MIPS
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 13
14 namespace v8 { 14 namespace v8 {
15 namespace internal { 15 namespace internal {
16 16
17 17
18 #define __ ACCESS_MASM(masm) 18 #define __ ACCESS_MASM(masm)
19 19
20 20 void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id) {
21 void Builtins::Generate_Adaptor(MacroAssembler* masm,
22 CFunctionId id,
23 BuiltinExtraArguments extra_args) {
24 // ----------- S t a t e ------------- 21 // ----------- S t a t e -------------
25 // -- a0 : number of arguments excluding receiver 22 // -- a0 : number of arguments excluding receiver
26 // -- a1 : target 23 // -- a1 : target
27 // -- a3 : new.target 24 // -- a3 : new.target
28 // -- sp[0] : last argument 25 // -- sp[0] : last argument
29 // -- ... 26 // -- ...
30 // -- sp[4 * (argc - 1)] : first argument 27 // -- sp[4 * (argc - 1)] : first argument
31 // -- sp[4 * agrc] : receiver 28 // -- sp[4 * agrc] : receiver
32 // ----------------------------------- 29 // -----------------------------------
33 __ AssertFunction(a1); 30 __ AssertFunction(a1);
34 31
35 // Make sure we operate in the context of the called function (for example 32 // Make sure we operate in the context of the called function (for example
36 // ConstructStubs implemented in C++ will be run in the context of the caller 33 // ConstructStubs implemented in C++ will be run in the context of the caller
37 // instead of the callee, due to the way that [[Construct]] is defined for 34 // instead of the callee, due to the way that [[Construct]] is defined for
38 // ordinary functions). 35 // ordinary functions).
39 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 36 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
40 37
41 // Insert extra arguments. 38 // Insert extra arguments.
42 int num_extra_args = 0; 39 const int num_extra_args = 2;
43 switch (extra_args) { 40 __ Push(a1, a3);
44 case BuiltinExtraArguments::kTarget:
45 __ Push(a1);
46 ++num_extra_args;
47 break;
48 case BuiltinExtraArguments::kNewTarget:
49 __ Push(a3);
50 ++num_extra_args;
51 break;
52 case BuiltinExtraArguments::kTargetAndNewTarget:
53 __ Push(a1, a3);
54 num_extra_args += 2;
55 break;
56 case BuiltinExtraArguments::kNone:
57 break;
58 }
59 41
60 // JumpToExternalReference expects a0 to contain the number of arguments 42 // JumpToExternalReference expects a0 to contain the number of arguments
61 // including the receiver and the extra arguments. 43 // including the receiver and the extra arguments.
62 __ Addu(a0, a0, num_extra_args + 1); 44 __ Addu(a0, a0, num_extra_args + 1);
63 45
64 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); 46 __ JumpToExternalReference(ExternalReference(id, masm->isolate()));
65 } 47 }
66 48
67 49
68 // Load the built-in InternalArray function from the current context. 50 // Load the built-in InternalArray function from the current context.
(...skipping 2906 matching lines...) Expand 10 before | Expand all | Expand 10 after
2975 } 2957 }
2976 } 2958 }
2977 2959
2978 2960
2979 #undef __ 2961 #undef __
2980 2962
2981 } // namespace internal 2963 } // namespace internal
2982 } // namespace v8 2964 } // namespace v8
2983 2965
2984 #endif // V8_TARGET_ARCH_MIPS 2966 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698