OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_S390 | 5 #if V8_TARGET_ARCH_S390 |
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 #define __ ACCESS_MASM(masm) | 16 #define __ ACCESS_MASM(masm) |
17 | 17 |
18 void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id, | 18 void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id) { |
19 BuiltinExtraArguments extra_args) { | |
20 // ----------- S t a t e ------------- | 19 // ----------- S t a t e ------------- |
21 // -- r2 : number of arguments excluding receiver | 20 // -- r2 : number of arguments excluding receiver |
22 // -- r3 : target | 21 // -- r3 : target |
23 // -- r5 : new.target | 22 // -- r5 : new.target |
24 // -- sp[0] : last argument | 23 // -- sp[0] : last argument |
25 // -- ... | 24 // -- ... |
26 // -- sp[4 * (argc - 1)] : first argument | 25 // -- sp[4 * (argc - 1)] : first argument |
27 // -- sp[4 * argc] : receiver | 26 // -- sp[4 * argc] : receiver |
28 // ----------------------------------- | 27 // ----------------------------------- |
29 __ AssertFunction(r3); | 28 __ AssertFunction(r3); |
30 | 29 |
31 // Make sure we operate in the context of the called function (for example | 30 // Make sure we operate in the context of the called function (for example |
32 // ConstructStubs implemented in C++ will be run in the context of the caller | 31 // ConstructStubs implemented in C++ will be run in the context of the caller |
33 // instead of the callee, due to the way that [[Construct]] is defined for | 32 // instead of the callee, due to the way that [[Construct]] is defined for |
34 // ordinary functions). | 33 // ordinary functions). |
35 __ LoadP(cp, FieldMemOperand(r3, JSFunction::kContextOffset)); | 34 __ LoadP(cp, FieldMemOperand(r3, JSFunction::kContextOffset)); |
36 | 35 |
37 // Insert extra arguments. | 36 // Insert extra arguments. |
38 int num_extra_args = 0; | 37 const int num_extra_args = 2; |
39 switch (extra_args) { | 38 __ Push(r3, r5); |
40 case BuiltinExtraArguments::kTarget: | |
41 __ Push(r3); | |
42 ++num_extra_args; | |
43 break; | |
44 case BuiltinExtraArguments::kNewTarget: | |
45 __ Push(r5); | |
46 ++num_extra_args; | |
47 break; | |
48 case BuiltinExtraArguments::kTargetAndNewTarget: | |
49 __ Push(r3, r5); | |
50 num_extra_args += 2; | |
51 break; | |
52 case BuiltinExtraArguments::kNone: | |
53 break; | |
54 } | |
55 | |
56 // JumpToExternalReference expects r2 to contain the number of arguments | 39 // JumpToExternalReference expects r2 to contain the number of arguments |
57 // including the receiver and the extra arguments. | 40 // including the receiver and the extra arguments. |
58 __ AddP(r2, r2, Operand(num_extra_args + 1)); | 41 __ AddP(r2, r2, Operand(num_extra_args + 1)); |
59 | 42 |
60 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); | 43 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); |
61 } | 44 } |
62 | 45 |
63 // Load the built-in InternalArray function from the current context. | 46 // Load the built-in InternalArray function from the current context. |
64 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, | 47 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, |
65 Register result) { | 48 Register result) { |
(...skipping 2835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2901 __ bkpt(0); | 2884 __ bkpt(0); |
2902 } | 2885 } |
2903 } | 2886 } |
2904 | 2887 |
2905 #undef __ | 2888 #undef __ |
2906 | 2889 |
2907 } // namespace internal | 2890 } // namespace internal |
2908 } // namespace v8 | 2891 } // namespace v8 |
2909 | 2892 |
2910 #endif // V8_TARGET_ARCH_S390 | 2893 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |