V8 Project
interface-descriptors.h
Go to the documentation of this file.
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 #ifndef V8_CALL_INTERFACE_DESCRIPTOR_H_
6 #define V8_CALL_INTERFACE_DESCRIPTOR_H_
7 
8 #include "src/assembler.h"
9 #include "src/macro-assembler.h"
10 
11 namespace v8 {
12 namespace internal {
13 
14 class PlatformInterfaceDescriptor;
15 
16 #define INTERFACE_DESCRIPTOR_LIST(V) \
17  V(Load) \
18  V(Store) \
19  V(ElementTransitionAndStore) \
20  V(Instanceof) \
21  V(VectorLoadICTrampoline) \
22  V(VectorLoadIC) \
23  V(FastNewClosure) \
24  V(FastNewContext) \
25  V(ToNumber) \
26  V(NumberToString) \
27  V(FastCloneShallowArray) \
28  V(FastCloneShallowObject) \
29  V(CreateAllocationSite) \
30  V(CallFunction) \
31  V(CallFunctionWithFeedback) \
32  V(CallConstruct) \
33  V(RegExpConstructResult) \
34  V(TransitionElementsKind) \
35  V(ArrayConstructorConstantArgCount) \
36  V(ArrayConstructor) \
37  V(InternalArrayConstructorConstantArgCount) \
38  V(InternalArrayConstructor) \
39  V(CompareNil) \
40  V(ToBoolean) \
41  V(BinaryOp) \
42  V(BinaryOpWithAllocationSite) \
43  V(StringAdd) \
44  V(Keyed) \
45  V(Named) \
46  V(CallHandler) \
47  V(ArgumentAdaptor) \
48  V(ApiGetter) \
49  V(ApiFunction) \
50  V(ArgumentsAccessRead) \
51  V(StoreArrayLiteralElement) \
52  V(MathPowTagged) \
53  V(MathPowInteger) \
54  V(ContextOnly)
55 
56 
58  public:
60 
61  // A copy of the passed in registers and param_representations is made
62  // and owned by the CallInterfaceDescriptorData.
63 
64  // TODO(mvstanton): Instead of taking parallel arrays register and
65  // param_representations, how about a struct that puts the representation
66  // and register side by side (eg, RegRep(r1, Representation::Tagged()).
67  // The same should go for the CodeStubDescriptor class.
68  void Initialize(int register_parameter_count, Register* registers,
69  Representation* param_representations,
70  PlatformInterfaceDescriptor* platform_descriptor = NULL);
71 
72  bool IsInitialized() const { return register_param_count_ >= 0; }
73 
75  Register register_param(int index) const { return register_params_[index]; }
76  Register* register_params() const { return register_params_.get(); }
78  return register_param_representations_[index];
79  }
82  }
85  }
86 
87  private:
89 
90  // The Register params are allocated dynamically by the
91  // InterfaceDescriptor, and freed on destruction. This is because static
92  // arrays of Registers cause creation of runtime static initializers
93  // which we don't want.
95  // Specifies Representations for the stub's parameter. Points to an array of
96  // Representations of the same length of the numbers of parameters to the
97  // stub, or if NULL (the default value), Representation of each parameter
98  // assumed to be Tagged().
100 
102 
104 };
105 
106 
108  public:
109  enum Key {
110 #define DEF_ENUM(name) name,
112 #undef DEF_ENUM
114  };
115 };
116 
117 
119  public:
121 
123  : data_(isolate->call_descriptor_data(key)) {}
124 
125  int GetEnvironmentLength() const { return data()->register_param_count(); }
126 
128  return data()->register_param_count();
129  }
130 
131  Register GetParameterRegister(int index) const {
132  return data()->register_param(index);
133  }
134 
136  DCHECK(index < data()->register_param_count());
137  if (data()->register_param_representations() == NULL) {
138  return Representation::Tagged();
139  }
140 
141  return data()->register_param_representation(index);
142  }
143 
144  // "Environment" versions of parameter functions. The first register
145  // parameter (context) is not included.
147  return GetEnvironmentLength() - 1;
148  }
149 
151  return GetParameterRegister(index + 1);
152  }
153 
155  return GetParameterRepresentation(index + 1);
156  }
157 
158  // Some platforms have extra information to associate with the descriptor.
161  }
162 
163  static const Register ContextRegister();
164 
165  const char* DebugName(Isolate* isolate);
166 
167  protected:
168  const CallInterfaceDescriptorData* data() const { return data_; }
169 
170  private:
172 };
173 
174 
175 #define DECLARE_DESCRIPTOR(name, base) \
176  explicit name(Isolate* isolate) : base(isolate, key()) { \
177  if (!data()->IsInitialized()) \
178  Initialize(isolate->call_descriptor_data(key())); \
179  } \
180  \
181  protected: \
182  void Initialize(CallInterfaceDescriptorData* data); \
183  name(Isolate* isolate, CallDescriptors::Key key) : base(isolate, key) {} \
184  \
185  public: \
186  static inline CallDescriptors::Key key();
187 
188 
189 // LoadDescriptor is used by all stubs that implement Load/KeyedLoad ICs.
191  public:
193 
195  static const Register ReceiverRegister();
196  static const Register NameRegister();
197 };
198 
199 
201  public:
203 
209  };
210  static const Register ReceiverRegister();
211  static const Register NameRegister();
212  static const Register ValueRegister();
213 };
214 
215 
217  public:
219 
220  static const Register MapRegister();
221 };
222 
223 
225  public:
227 
229  static const Register left();
230  static const Register right();
231 };
232 
233 
235  public:
237 
239 
240  static const Register SlotRegister();
241 };
242 
243 
245  public:
247 
252  kVectorIndex
253  };
254 
255  static const Register VectorRegister();
256 };
257 
258 
260  public:
262 };
263 
264 
266  public:
268 };
269 
270 
272  public:
274 };
275 
276 
278  public:
280 };
281 
282 
284  public:
286 };
287 
288 
290  public:
292 };
293 
294 
296  public:
298 };
299 
300 
302  public:
304 };
305 
306 
308  public:
311 };
312 
313 
315  public:
317 };
318 
319 
321  public:
323 };
324 
325 
327  public:
329 };
330 
331 
333  : public CallInterfaceDescriptor {
334  public:
337 };
338 
339 
341  public:
343 };
344 
345 
347  : public CallInterfaceDescriptor {
348  public:
351 };
352 
353 
355  public:
358 };
359 
360 
362  public:
364 };
365 
366 
368  public:
370 };
371 
372 
374  public:
376 };
377 
378 
380  public:
383 };
384 
385 
387  public:
389 };
390 
391 
393  public:
395 };
396 
397 
399  public:
401 };
402 
403 
405  public:
407 };
408 
409 
411  public:
413 };
414 
415 
417  public:
419 };
420 
421 
423  public:
425 
426  static const Register function_address();
427 };
428 
429 
431  public:
433 
434  static const Register index();
435  static const Register parameter_count();
436 };
437 
438 
440  public:
443 };
444 
445 
447  public:
449 
450  static const Register exponent();
451 };
452 
453 
455  public:
457 
458  static const Register exponent();
459 };
460 
461 
463  public:
465 };
466 
467 #undef DECLARE_DESCRIPTOR
468 
469 
470 // We define the association between CallDescriptors::Key and the specialized
471 // descriptor here to reduce boilerplate and mistakes.
472 #define DEF_KEY(name) \
473  CallDescriptors::Key name##Descriptor::key() { return CallDescriptors::name; }
475 #undef DEF_KEY
476 }
477 } // namespace v8::internal
478 
479 
480 #if V8_TARGET_ARCH_ARM64
482 #elif V8_TARGET_ARCH_ARM
484 #endif
485 
486 #endif // V8_CALL_INTERFACE_DESCRIPTOR_H_
Representation register_param_representation(int index) const
SmartArrayPointer< Register > register_params_
DISALLOW_COPY_AND_ASSIGN(CallInterfaceDescriptorData)
PlatformInterfaceDescriptor * platform_specific_descriptor_
void Initialize(int register_parameter_count, Register *registers, Representation *param_representations, PlatformInterfaceDescriptor *platform_descriptor=NULL)
PlatformInterfaceDescriptor * platform_specific_descriptor() const
SmartArrayPointer< Representation > register_param_representations_
Representation * register_param_representations() const
const char * DebugName(Isolate *isolate)
Register GetParameterRegister(int index) const
PlatformInterfaceDescriptor * platform_specific_descriptor() const
Register GetEnvironmentParameterRegister(int index) const
Representation GetParameterRepresentation(int index) const
Representation GetEnvironmentParameterRepresentation(int index) const
const CallInterfaceDescriptorData * data_
static const Register ContextRegister()
CallInterfaceDescriptor(Isolate *isolate, CallDescriptors::Key key)
const CallInterfaceDescriptorData * data() const
static const Register left()
static const Register right()
static const Register ReceiverRegister()
static const Register NameRegister()
static Representation Tagged()
static const Register ReceiverRegister()
static const Register NameRegister()
static const Register ValueRegister()
static const Register VectorRegister()
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define DEF_ENUM(name)
#define INTERFACE_DESCRIPTOR_LIST(V)
#define DEF_KEY(name)
#define DECLARE_DESCRIPTOR(name, base)
#define DCHECK(condition)
Definition: logging.h:205
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20