V8 Project
interface-descriptors.cc
Go to the documentation of this file.
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
3 // found in the LICENSE file.
4 
5 #include "src/v8.h"
6 
8 
9 namespace v8 {
10 namespace internal {
11 
13  int register_parameter_count, Register* registers,
14  Representation* register_param_representations,
15  PlatformInterfaceDescriptor* platform_descriptor) {
16  platform_specific_descriptor_ = platform_descriptor;
17  register_param_count_ = register_parameter_count;
18 
19  // An interface descriptor must have a context register.
20  DCHECK(register_parameter_count > 0 &&
21  registers[0].is(CallInterfaceDescriptor::ContextRegister()));
22 
23  // InterfaceDescriptor owns a copy of the registers array.
24  register_params_.Reset(NewArray<Register>(register_parameter_count));
25  for (int i = 0; i < register_parameter_count; i++) {
26  register_params_[i] = registers[i];
27  }
28 
29  // If a representations array is specified, then the descriptor owns that as
30  // well.
33  NewArray<Representation>(register_parameter_count));
34  for (int i = 0; i < register_parameter_count; i++) {
35  // If there is a context register, the representation must be tagged.
36  DCHECK(
37  i != 0 ||
40  }
41  }
42 }
43 
44 
47  size_t index = data_ - start;
49  CallDescriptors::Key key = static_cast<CallDescriptors::Key>(index);
50  switch (key) {
51 #define DEF_CASE(NAME) \
52  case CallDescriptors::NAME: \
53  return #NAME " Descriptor";
55 #undef DEF_CASE
57  break;
58  }
59  return "";
60 }
61 
62 
63 void LoadDescriptor::Initialize(CallInterfaceDescriptorData* data) {
64  Register registers[] = {ContextRegister(), ReceiverRegister(),
65  NameRegister()};
66  data->Initialize(arraysize(registers), registers, NULL);
67 }
68 
69 
70 void StoreDescriptor::Initialize(CallInterfaceDescriptorData* data) {
71  Register registers[] = {ContextRegister(), ReceiverRegister(), NameRegister(),
72  ValueRegister()};
73  data->Initialize(arraysize(registers), registers, NULL);
74 }
75 
76 
77 void ElementTransitionAndStoreDescriptor::Initialize(
78  CallInterfaceDescriptorData* data) {
79  Register registers[] = {ContextRegister(), ValueRegister(), MapRegister(),
81  data->Initialize(arraysize(registers), registers, NULL);
82 }
83 
84 
85 void InstanceofDescriptor::Initialize(CallInterfaceDescriptorData* data) {
86  Register registers[] = {ContextRegister(), left(), right()};
87  data->Initialize(arraysize(registers), registers, NULL);
88 }
89 
90 
91 void MathPowTaggedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
92  Register registers[] = {ContextRegister(), exponent()};
93  data->Initialize(arraysize(registers), registers, NULL);
94 }
95 
96 
97 void MathPowIntegerDescriptor::Initialize(CallInterfaceDescriptorData* data) {
98  Register registers[] = {ContextRegister(), exponent()};
99  data->Initialize(arraysize(registers), registers, NULL);
100 }
101 
102 
103 void VectorLoadICTrampolineDescriptor::Initialize(
104  CallInterfaceDescriptorData* data) {
105  Register registers[] = {ContextRegister(), ReceiverRegister(), NameRegister(),
106  SlotRegister()};
107  data->Initialize(arraysize(registers), registers, NULL);
108 }
109 
110 
111 void VectorLoadICDescriptor::Initialize(CallInterfaceDescriptorData* data) {
112  Register registers[] = {ContextRegister(), ReceiverRegister(), NameRegister(),
114  Representation representations[] = {
118  data->Initialize(arraysize(registers), registers, representations);
119 }
120 
121 
122 void ApiGetterDescriptor::Initialize(CallInterfaceDescriptorData* data) {
123  Register registers[] = {ContextRegister(), function_address()};
124  Representation representations[] = {Representation::Tagged(),
126  data->Initialize(arraysize(registers), registers, representations);
127 }
128 
129 
130 void ArgumentsAccessReadDescriptor::Initialize(
131  CallInterfaceDescriptorData* data) {
132  Register registers[] = {ContextRegister(), index(), parameter_count()};
133  data->Initialize(arraysize(registers), registers, NULL);
134 }
135 
136 
137 void ContextOnlyDescriptor::Initialize(CallInterfaceDescriptorData* data) {
138  Register registers[] = {ContextRegister()};
139  data->Initialize(arraysize(registers), registers, NULL);
140 }
141 
142 }
143 } // namespace v8::internal
static const Register function_address()
SmartArrayPointer< Register > register_params_
PlatformInterfaceDescriptor * platform_specific_descriptor_
void Initialize(int register_parameter_count, Register *registers, Representation *param_representations, PlatformInterfaceDescriptor *platform_descriptor=NULL)
SmartArrayPointer< Representation > register_param_representations_
Representation * register_param_representations() const
const char * DebugName(Isolate *isolate)
const CallInterfaceDescriptorData * data_
static const Register ContextRegister()
const CallInterfaceDescriptorData * data() const
static const Register left()
static const Register right()
CallInterfaceDescriptorData * call_descriptor_data(int index)
Definition: isolate.cc:2208
static const Register ReceiverRegister()
static const Register NameRegister()
static const Register exponent()
static const Register exponent()
static Representation External()
static Representation Smi()
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_CASE(NAME)
#define INTERFACE_DESCRIPTOR_LIST(V)
#define DCHECK(condition)
Definition: logging.h:205
#define arraysize(array)
Definition: macros.h:86
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20