1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
// Copyright 2012 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/v8.h"
#include "src/interface-descriptors.h"
namespace v8 {
namespace internal {
void CallInterfaceDescriptorData::Initialize(
int register_parameter_count, Register* registers,
Representation* register_param_representations,
PlatformInterfaceDescriptor* platform_descriptor) {
platform_specific_descriptor_ = platform_descriptor;
register_param_count_ = register_parameter_count;
// An interface descriptor must have a context register.
DCHECK(register_parameter_count > 0 &&
registers[0].is(CallInterfaceDescriptor::ContextRegister()));
// InterfaceDescriptor owns a copy of the registers array.
register_params_.Reset(NewArray<Register>(register_parameter_count));
for (int i = 0; i < register_parameter_count; i++) {
register_params_[i] = registers[i];
}
// If a representations array is specified, then the descriptor owns that as
// well.
if (register_param_representations != NULL) {
register_param_representations_.Reset(
NewArray<Representation>(register_parameter_count));
for (int i = 0; i < register_parameter_count; i++) {
// If there is a context register, the representation must be tagged.
DCHECK(
i != 0 ||
register_param_representations[i].Equals(Representation::Tagged()));
register_param_representations_[i] = register_param_representations[i];
}
}
}
const char* CallInterfaceDescriptor::DebugName(Isolate* isolate) const {
CallInterfaceDescriptorData* start = isolate->call_descriptor_data(0);
size_t index = data_ - start;
DCHECK(index < CallDescriptors::NUMBER_OF_DESCRIPTORS);
CallDescriptors::Key key = static_cast<CallDescriptors::Key>(index);
switch (key) {
#define DEF_CASE(NAME) \
case CallDescriptors::NAME: \
return #NAME " Descriptor";
INTERFACE_DESCRIPTOR_LIST(DEF_CASE)
#undef DEF_CASE
case CallDescriptors::NUMBER_OF_DESCRIPTORS:
break;
}
return "";
}
void LoadDescriptor::Initialize(CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), ReceiverRegister(),
NameRegister()};
data->Initialize(arraysize(registers), registers, NULL);
}
void StoreDescriptor::Initialize(CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), ReceiverRegister(), NameRegister(),
ValueRegister()};
data->Initialize(arraysize(registers), registers, NULL);
}
void StoreTransitionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), ReceiverRegister(), NameRegister(),
ValueRegister(), MapRegister()};
data->Initialize(arraysize(registers), registers, NULL);
}
void ElementTransitionAndStoreDescriptor::Initialize(
CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), ValueRegister(), MapRegister(),
NameRegister(), ReceiverRegister()};
data->Initialize(arraysize(registers), registers, NULL);
}
void InstanceofDescriptor::Initialize(CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), left(), right()};
data->Initialize(arraysize(registers), registers, NULL);
}
void MathPowTaggedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), exponent()};
data->Initialize(arraysize(registers), registers, NULL);
}
void MathPowIntegerDescriptor::Initialize(CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), exponent()};
data->Initialize(arraysize(registers), registers, NULL);
}
void VectorLoadICTrampolineDescriptor::Initialize(
CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), ReceiverRegister(), NameRegister(),
SlotRegister()};
data->Initialize(arraysize(registers), registers, NULL);
}
void VectorLoadICDescriptor::Initialize(CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), ReceiverRegister(), NameRegister(),
SlotRegister(), VectorRegister()};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(),
Representation::Tagged(), Representation::Smi(),
Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
}
void ApiGetterDescriptor::Initialize(CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), function_address()};
Representation representations[] = {Representation::Tagged(),
Representation::External()};
data->Initialize(arraysize(registers), registers, representations);
}
void ArgumentsAccessReadDescriptor::Initialize(
CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), index(), parameter_count()};
data->Initialize(arraysize(registers), registers, NULL);
}
void ContextOnlyDescriptor::Initialize(CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister()};
data->Initialize(arraysize(registers), registers, NULL);
}
void GrowArrayElementsDescriptor::Initialize(
CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), ObjectRegister(), KeyRegister(),
CapacityRegister()};
data->Initialize(arraysize(registers), registers, NULL);
}
}
} // namespace v8::internal
|