V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
interface-descriptors-ppc.cc
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
3 // found in the LICENSE file.
4 
5 #if V8_TARGET_ARCH_PPC
6 
7 #include "src/interface-descriptors.h"
8 #include "src/macro-assembler.h"
9 
10 namespace v8 {
11 namespace internal {
12 
13 const Register CallInterfaceDescriptor::ContextRegister() { return cp; }
14 
15 void CallInterfaceDescriptor::DefaultInitializePlatformSpecific(
16  CallInterfaceDescriptorData* data, int register_parameter_count) {
17  const Register default_stub_registers[] = {r3, r4, r5, r6, r7};
18  CHECK_LE(static_cast<size_t>(register_parameter_count),
19  arraysize(default_stub_registers));
20  data->InitializePlatformSpecific(register_parameter_count,
21  default_stub_registers);
22 }
23 
24 void RecordWriteDescriptor::InitializePlatformSpecific(
25  CallInterfaceDescriptorData* data) {
26  const Register default_stub_registers[] = {r3, r4, r5, r6, r7};
27 
28  data->RestrictAllocatableRegisters(default_stub_registers,
29  arraysize(default_stub_registers));
30 
31  CHECK_LE(static_cast<size_t>(kParameterCount),
32  arraysize(default_stub_registers));
33  data->InitializePlatformSpecific(kParameterCount, default_stub_registers);
34 }
35 
36 const Register FastNewFunctionContextDescriptor::ScopeInfoRegister() {
37  return r4;
38 }
39 const Register FastNewFunctionContextDescriptor::SlotsRegister() { return r3; }
40 
41 const Register LoadDescriptor::ReceiverRegister() { return r4; }
42 const Register LoadDescriptor::NameRegister() { return r5; }
43 const Register LoadDescriptor::SlotRegister() { return r3; }
44 
45 const Register LoadWithVectorDescriptor::VectorRegister() { return r6; }
46 
47 const Register StoreDescriptor::ReceiverRegister() { return r4; }
48 const Register StoreDescriptor::NameRegister() { return r5; }
49 const Register StoreDescriptor::ValueRegister() { return r3; }
50 const Register StoreDescriptor::SlotRegister() { return r7; }
51 
52 const Register StoreWithVectorDescriptor::VectorRegister() { return r6; }
53 
54 const Register StoreTransitionDescriptor::SlotRegister() { return r7; }
55 const Register StoreTransitionDescriptor::VectorRegister() { return r6; }
56 const Register StoreTransitionDescriptor::MapRegister() { return r8; }
57 
58 const Register ApiGetterDescriptor::HolderRegister() { return r3; }
59 const Register ApiGetterDescriptor::CallbackRegister() { return r6; }
60 
61 const Register GrowArrayElementsDescriptor::ObjectRegister() { return r3; }
62 const Register GrowArrayElementsDescriptor::KeyRegister() { return r6; }
63 
64 
65 // static
66 const Register TypeConversionDescriptor::ArgumentRegister() { return r3; }
67 
68 void TypeofDescriptor::InitializePlatformSpecific(
69  CallInterfaceDescriptorData* data) {
70  Register registers[] = {r6};
71  data->InitializePlatformSpecific(arraysize(registers), registers);
72 }
73 
74 void CallFunctionDescriptor::InitializePlatformSpecific(
75  CallInterfaceDescriptorData* data) {
76  Register registers[] = {r4};
77  data->InitializePlatformSpecific(arraysize(registers), registers);
78 }
79 
80 void CallTrampolineDescriptor::InitializePlatformSpecific(
81  CallInterfaceDescriptorData* data) {
82  // r3 : number of arguments
83  // r4 : the target to call
84  Register registers[] = {r4, r3};
85  data->InitializePlatformSpecific(arraysize(registers), registers);
86 }
87 
88 void CallVarargsDescriptor::InitializePlatformSpecific(
89  CallInterfaceDescriptorData* data) {
90  // r3 : number of arguments (on the stack, not including receiver)
91  // r4 : the target to call
92  // r7 : arguments list length (untagged)
93  // r5 : arguments list (FixedArray)
94  Register registers[] = {r4, r3, r7, r5};
95  data->InitializePlatformSpecific(arraysize(registers), registers);
96 }
97 
98 void CallForwardVarargsDescriptor::InitializePlatformSpecific(
99  CallInterfaceDescriptorData* data) {
100  // r3 : number of arguments
101  // r5 : start index (to support rest parameters)
102  // r4 : the target to call
103  Register registers[] = {r4, r3, r5};
104  data->InitializePlatformSpecific(arraysize(registers), registers);
105 }
106 
107 void CallWithSpreadDescriptor::InitializePlatformSpecific(
108  CallInterfaceDescriptorData* data) {
109  // r3 : number of arguments (on the stack, not including receiver)
110  // r4 : the target to call
111  // r5 : the object to spread
112  Register registers[] = {r4, r3, r5};
113  data->InitializePlatformSpecific(arraysize(registers), registers);
114 }
115 
116 void CallWithArrayLikeDescriptor::InitializePlatformSpecific(
117  CallInterfaceDescriptorData* data) {
118  // r4 : the target to call
119  // r5 : the arguments list
120  Register registers[] = {r4, r5};
121  data->InitializePlatformSpecific(arraysize(registers), registers);
122 }
123 
124 void ConstructVarargsDescriptor::InitializePlatformSpecific(
125  CallInterfaceDescriptorData* data) {
126  // r3 : number of arguments (on the stack, not including receiver)
127  // r4 : the target to call
128  // r6 : the new target
129  // r7 : arguments list length (untagged)
130  // r5 : arguments list (FixedArray)
131  Register registers[] = {r4, r6, r3, r7, r5};
132  data->InitializePlatformSpecific(arraysize(registers), registers);
133 }
134 
135 void ConstructForwardVarargsDescriptor::InitializePlatformSpecific(
136  CallInterfaceDescriptorData* data) {
137  // r3 : number of arguments
138  // r6 : the new target
139  // r5 : start index (to support rest parameters)
140  // r4 : the target to call
141  Register registers[] = {r4, r6, r3, r5};
142  data->InitializePlatformSpecific(arraysize(registers), registers);
143 }
144 
145 void ConstructWithSpreadDescriptor::InitializePlatformSpecific(
146  CallInterfaceDescriptorData* data) {
147  // r3 : number of arguments (on the stack, not including receiver)
148  // r4 : the target to call
149  // r6 : the new target
150  // r5 : the object to spread
151  Register registers[] = {r4, r6, r3, r5};
152  data->InitializePlatformSpecific(arraysize(registers), registers);
153 }
154 
155 void ConstructWithArrayLikeDescriptor::InitializePlatformSpecific(
156  CallInterfaceDescriptorData* data) {
157  // r4 : the target to call
158  // r6 : the new target
159  // r5 : the arguments list
160  Register registers[] = {r4, r6, r5};
161  data->InitializePlatformSpecific(arraysize(registers), registers);
162 }
163 
164 void ConstructStubDescriptor::InitializePlatformSpecific(
165  CallInterfaceDescriptorData* data) {
166  // r3 : number of arguments
167  // r4 : the target to call
168  // r6 : the new target
169  // r5 : allocation site or undefined
170  Register registers[] = {r4, r6, r3, r5};
171  data->InitializePlatformSpecific(arraysize(registers), registers);
172 }
173 
174 void AbortDescriptor::InitializePlatformSpecific(
175  CallInterfaceDescriptorData* data) {
176  Register registers[] = {r4};
177  data->InitializePlatformSpecific(arraysize(registers), registers);
178 }
179 
180 void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
181  CallInterfaceDescriptorData* data) {
182  data->InitializePlatformSpecific(0, nullptr);
183 }
184 
185 void CompareDescriptor::InitializePlatformSpecific(
186  CallInterfaceDescriptorData* data) {
187  Register registers[] = {r4, r3};
188  data->InitializePlatformSpecific(arraysize(registers), registers);
189 }
190 
191 
192 void BinaryOpDescriptor::InitializePlatformSpecific(
193  CallInterfaceDescriptorData* data) {
194  Register registers[] = {r4, r3};
195  data->InitializePlatformSpecific(arraysize(registers), registers);
196 }
197 
198 void ArgumentsAdaptorDescriptor::InitializePlatformSpecific(
199  CallInterfaceDescriptorData* data) {
200  Register registers[] = {
201  r4, // JSFunction
202  r6, // the new target
203  r3, // actual number of arguments
204  r5, // expected number of arguments
205  };
206  data->InitializePlatformSpecific(arraysize(registers), registers);
207 }
208 
209 void ApiCallbackDescriptor::InitializePlatformSpecific(
210  CallInterfaceDescriptorData* data) {
211  Register registers[] = {
212  JavaScriptFrame::context_register(), // callee context
213  r7, // call_data
214  r5, // holder
215  r4, // api_function_address
216  };
217  data->InitializePlatformSpecific(arraysize(registers), registers);
218 }
219 
220 void InterpreterDispatchDescriptor::InitializePlatformSpecific(
221  CallInterfaceDescriptorData* data) {
222  Register registers[] = {
223  kInterpreterAccumulatorRegister, kInterpreterBytecodeOffsetRegister,
224  kInterpreterBytecodeArrayRegister, kInterpreterDispatchTableRegister};
225  data->InitializePlatformSpecific(arraysize(registers), registers);
226 }
227 
228 void InterpreterPushArgsThenCallDescriptor::InitializePlatformSpecific(
229  CallInterfaceDescriptorData* data) {
230  Register registers[] = {
231  r3, // argument count (not including receiver)
232  r5, // address of first argument
233  r4 // the target callable to be call
234  };
235  data->InitializePlatformSpecific(arraysize(registers), registers);
236 }
237 
238 void InterpreterPushArgsThenConstructDescriptor::InitializePlatformSpecific(
239  CallInterfaceDescriptorData* data) {
240  Register registers[] = {
241  r3, // argument count (not including receiver)
242  r7, // address of the first argument
243  r4, // constructor to call
244  r6, // new target
245  r5, // allocation site feedback if available, undefined otherwise
246  };
247  data->InitializePlatformSpecific(arraysize(registers), registers);
248 }
249 
250 void ResumeGeneratorDescriptor::InitializePlatformSpecific(
251  CallInterfaceDescriptorData* data) {
252  Register registers[] = {
253  r3, // the value to pass to the generator
254  r4 // the JSGeneratorObject to resume
255  };
256  data->InitializePlatformSpecific(arraysize(registers), registers);
257 }
258 
259 void FrameDropperTrampolineDescriptor::InitializePlatformSpecific(
260  CallInterfaceDescriptorData* data) {
261  Register registers[] = {
262  r4, // loaded new FP
263  };
264  data->InitializePlatformSpecific(arraysize(registers), registers);
265 }
266 
267 } // namespace internal
268 } // namespace v8
269 
270 #endif // V8_TARGET_ARCH_PPC
Definition: libplatform.h:13