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_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 |
20 void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id, | 20 void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id) { |
21 BuiltinExtraArguments extra_args) { | |
22 // ----------- S t a t e ------------- | 21 // ----------- S t a t e ------------- |
23 // -- r3 : number of arguments excluding receiver | 22 // -- r3 : number of arguments excluding receiver |
24 // -- r4 : target | 23 // -- r4 : target |
25 // -- r6 : new.target | 24 // -- r6 : new.target |
26 // -- sp[0] : last argument | 25 // -- sp[0] : last argument |
27 // -- ... | 26 // -- ... |
28 // -- sp[4 * (argc - 1)] : first argument | 27 // -- sp[4 * (argc - 1)] : first argument |
29 // -- sp[4 * argc] : receiver | 28 // -- sp[4 * argc] : receiver |
30 // ----------------------------------- | 29 // ----------------------------------- |
31 __ AssertFunction(r4); | 30 __ AssertFunction(r4); |
32 | 31 |
33 // 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 |
34 // 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 |
35 // 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 |
36 // ordinary functions). | 35 // ordinary functions). |
37 __ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset)); | 36 __ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset)); |
38 | 37 |
39 // Insert extra arguments. | 38 // Insert extra arguments. |
40 int num_extra_args = 0; | 39 const int num_extra_args = 2; |
41 switch (extra_args) { | 40 __ Push(r4, r6); |
42 case BuiltinExtraArguments::kTarget: | |
43 __ Push(r4); | |
44 ++num_extra_args; | |
45 break; | |
46 case BuiltinExtraArguments::kNewTarget: | |
47 __ Push(r6); | |
48 ++num_extra_args; | |
49 break; | |
50 case BuiltinExtraArguments::kTargetAndNewTarget: | |
51 __ Push(r4, r6); | |
52 num_extra_args += 2; | |
53 break; | |
54 case BuiltinExtraArguments::kNone: | |
55 break; | |
56 } | |
57 | |
58 // JumpToExternalReference expects r3 to contain the number of arguments | 41 // JumpToExternalReference expects r3 to contain the number of arguments |
59 // including the receiver and the extra arguments. | 42 // including the receiver and the extra arguments. |
60 __ addi(r3, r3, Operand(num_extra_args + 1)); | 43 __ addi(r3, r3, Operand(num_extra_args + 1)); |
61 | 44 |
62 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); | 45 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); |
63 } | 46 } |
64 | 47 |
65 | 48 |
66 // Load the built-in InternalArray function from the current context. | 49 // Load the built-in InternalArray function from the current context. |
67 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, | 50 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, |
(...skipping 2869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2937 __ bkpt(0); | 2920 __ bkpt(0); |
2938 } | 2921 } |
2939 } | 2922 } |
2940 | 2923 |
2941 | 2924 |
2942 #undef __ | 2925 #undef __ |
2943 } // namespace internal | 2926 } // namespace internal |
2944 } // namespace v8 | 2927 } // namespace v8 |
2945 | 2928 |
2946 #endif // V8_TARGET_ARCH_PPC | 2929 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |