v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
handler-configuration-inl.h
Go to the documentation of this file.
1// Copyright 2016 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_IC_HANDLER_CONFIGURATION_INL_H_
6#define V8_IC_HANDLER_CONFIGURATION_INL_H_
7
9// Include the non-inl header before the rest of the headers.
10
17#include "src/objects/smi.h"
18
19// Has to be the last include (doesn't have include guards):
21
22namespace v8 {
23namespace internal {
24
25// Decodes kind from Smi-handler.
29
31 int config = KindBits::encode(Kind::kNormal);
32 return handle(Smi::FromInt(config), isolate);
33}
34
36 int config = KindBits::encode(Kind::kGlobal);
37 return handle(Smi::FromInt(config), isolate);
38}
39
42 return handle(Smi::FromInt(config), isolate);
43}
44
46 int config = KindBits::encode(Kind::kSlow);
47 return handle(Smi::FromInt(config), isolate);
48}
49
51 int config = KindBits::encode(Kind::kField) |
52 IsInobjectBits::encode(field_index.is_inobject()) |
53 IsDoubleBits::encode(field_index.is_double()) |
54 FieldIndexBits::encode(field_index.index());
55 return handle(Smi::FromInt(config), isolate);
56}
57
66
71
76
78 int config = KindBits::encode(Kind::kProxy);
79 return handle(Smi::FromInt(config), isolate);
80}
81
83 int descriptor) {
85 DescriptorBits::encode(descriptor);
86 return handle(Smi::FromInt(config), isolate);
87}
88
91 return handle(Smi::FromInt(config), isolate);
92}
93
95 int config =
97 return handle(Smi::FromInt(config), isolate);
98}
99
102 return handle(Smi::FromInt(config), isolate);
103}
104
106 ElementsKind elements_kind,
107 bool is_js_array,
108 KeyedAccessLoadMode load_mode) {
110 IsHoleyElementsKind(elements_kind));
111 int config = KindBits::encode(Kind::kElement) |
113 ElementsKindBits::encode(elements_kind) |
115 IsJsArrayBits::encode(is_js_array);
116 return handle(Smi::FromInt(config), isolate);
117}
118
125
132
137
139 int config = KindBits::encode(Kind::kNormal);
140 return handle(Smi::FromInt(config), isolate);
141}
142
145 return handle(Smi::FromInt(config), isolate);
146}
147
149 Isolate* isolate, KeyedAccessStoreMode mode) {
150 switch (mode) {
152 return BUILTIN_CODE(isolate, KeyedStoreIC_SloppyArguments_InBounds);
154 return BUILTIN_CODE(
155 isolate, KeyedStoreIC_SloppyArguments_NoTransitionGrowAndHandleCOW);
157 return BUILTIN_CODE(
158 isolate,
159 KeyedStoreIC_SloppyArguments_NoTransitionIgnoreTypedArrayOOB);
161 return BUILTIN_CODE(isolate,
162 KeyedStoreIC_SloppyArguments_NoTransitionHandleCOW);
163 default:
164 UNREACHABLE();
165 }
166}
167
170 switch (mode) {
172 return BUILTIN_CODE(isolate, StoreFastElementIC_InBounds);
174 return BUILTIN_CODE(isolate,
175 StoreFastElementIC_NoTransitionGrowAndHandleCOW);
177 return BUILTIN_CODE(isolate,
178 StoreFastElementIC_NoTransitionIgnoreTypedArrayOOB);
180 return BUILTIN_CODE(isolate, StoreFastElementIC_NoTransitionHandleCOW);
181 default:
182 UNREACHABLE();
183 }
184}
185
187 Isolate* isolate, KeyedAccessStoreMode mode) {
188 switch (mode) {
190 return BUILTIN_CODE(isolate, ElementsTransitionAndStore_InBounds);
192 return BUILTIN_CODE(
193 isolate, ElementsTransitionAndStore_NoTransitionGrowAndHandleCOW);
195 return BUILTIN_CODE(
196 isolate, ElementsTransitionAndStore_NoTransitionIgnoreTypedArrayOOB);
198 return BUILTIN_CODE(isolate,
199 ElementsTransitionAndStore_NoTransitionHandleCOW);
200 default:
201 UNREACHABLE();
202 }
203}
204
206 KeyedAccessStoreMode store_mode) {
207 int config = KindBits::encode(Kind::kSlow) |
209 return handle(Smi::FromInt(config), isolate);
210}
211
213 return handle(StoreProxy(), isolate);
214}
215
217 int config = KindBits::encode(Kind::kProxy);
218 return Smi::FromInt(config);
219}
220
222 int descriptor, FieldIndex field_index,
223 Representation representation) {
224 DCHECK(!representation.IsNone());
227
228 int config = KindBits::encode(kind) |
229 IsInobjectBits::encode(field_index.is_inobject()) |
230 RepresentationBits::encode(representation.kind()) |
231 DescriptorBits::encode(descriptor) |
232 FieldIndexBits::encode(field_index.index());
233 return handle(Smi::FromInt(config), isolate);
234}
235
237 FieldIndex field_index,
238 PropertyConstness constness,
239 Representation representation) {
242 return StoreField(isolate, kind, descriptor, field_index, representation);
243}
244
246 Isolate* isolate, int descriptor, FieldIndex field_index,
247 Representation representation) {
248 DCHECK(representation.Equals(Representation::Tagged()));
249 return StoreField(isolate, Kind::kSharedStructField, descriptor, field_index,
250 representation);
251}
252
254 int descriptor) {
256 DescriptorBits::encode(descriptor);
257 return handle(Smi::FromInt(config), isolate);
258}
259
264
269
270inline const char* WasmValueType2String(WasmValueType type) {
271 switch (type) {
273 return "i8";
275 return "i16";
277 return "i32";
279 return "u32";
281 return "i64";
283 return "f32";
285 return "f64";
287 return "s128";
288
290 return "Ref";
292 return "RefNull";
293
295 return "???";
296 }
297}
298
299} // namespace internal
300} // namespace v8
301
303
304#endif // V8_IC_HANDLER_CONFIGURATION_INL_H_
Builtins::Kind kind
Definition builtins.cc:40
#define BUILTIN_CODE(isolate, name)
Definition builtins.h:45
static constexpr T decode(U value)
Definition bit-field.h:66
static constexpr U encode(T value)
Definition bit-field.h:55
Tagged< UnionOf< Smi, Code > > smi_handler() const
static Handle< Smi > LoadSlow(Isolate *isolate)
static DirectHandle< Smi > LoadAccessorFromPrototype(Isolate *isolate)
static Kind GetHandlerKind(Tagged< Smi > smi_handler)
static Handle< Smi > LoadNativeDataProperty(Isolate *isolate, int descriptor)
static Handle< Smi > LoadConstantFromPrototype(Isolate *isolate)
static Handle< Smi > LoadProxy(Isolate *isolate)
static Handle< Smi > LoadNormal(Isolate *isolate)
static Handle< Smi > LoadField(Isolate *isolate, FieldIndex field_index)
static Handle< Smi > LoadNonExistent(Isolate *isolate)
static Handle< Smi > LoadInterceptor(Isolate *isolate)
static Handle< Smi > LoadModuleExport(Isolate *isolate, int index)
static DirectHandle< Smi > LoadWasmArrayElement(Isolate *isolate, WasmValueType type)
static Handle< Smi > LoadIndexedString(Isolate *isolate, KeyedAccessLoadMode load_mode)
static DirectHandle< Smi > LoadWasmStructField(Isolate *isolate, WasmValueType type, int offset)
static Handle< Smi > LoadApiGetter(Isolate *isolate)
static Handle< Smi > LoadElement(Isolate *isolate, ElementsKind elements_kind, bool is_js_array, KeyedAccessLoadMode load_mode)
static Handle< Smi > LoadGlobal(Isolate *isolate)
constexpr bool IsNone() const
constexpr Kind kind() const
bool Equals(const Representation &other) const
static constexpr Representation Tagged()
static constexpr Tagged< Smi > FromInt(int value)
Definition smi.h:38
static Handle< Smi > StoreNormal(Isolate *isolate)
static Handle< Smi > StoreSlow(Isolate *isolate, KeyedAccessStoreMode store_mode=KeyedAccessStoreMode::kInBounds)
static Handle< Smi > StoreSharedStructField(Isolate *isolate, int descriptor, FieldIndex field_index, Representation representation)
static Handle< Smi > StoreNativeDataProperty(Isolate *isolate, int descriptor)
static Handle< Smi > StoreField(Isolate *isolate, int descriptor, FieldIndex field_index, PropertyConstness constness, Representation representation)
static DirectHandle< Smi > StoreGlobalProxy(Isolate *isolate)
static Handle< Code > StoreFastElementBuiltin(Isolate *isolate, KeyedAccessStoreMode mode)
static DirectHandle< Smi > StoreApiSetter(Isolate *isolate)
static DirectHandle< Smi > StoreAccessorFromPrototype(Isolate *isolate)
static Handle< Smi > StoreInterceptor(Isolate *isolate)
static Handle< Code > StoreSloppyArgumentsBuiltin(Isolate *isolate, KeyedAccessStoreMode mode)
static DirectHandle< Code > ElementsTransitionAndStoreBuiltin(Isolate *isolate, KeyedAccessStoreMode mode)
int32_t offset
V8_INLINE IndirectHandle< T > handle(Tagged< T > object, Isolate *isolate)
Definition handles-inl.h:72
constexpr bool IsHoleyElementsKind(ElementsKind kind)
V8_INLINE DirectHandle< T > direct_handle(Tagged< T > object, Isolate *isolate)
bool LoadModeHandlesHoles(KeyedAccessLoadMode load_mode)
Definition globals.h:2695
bool LoadModeHandlesOOB(KeyedAccessLoadMode load_mode)
Definition globals.h:2689
const char * WasmValueType2String(WasmValueType type)
#define DCHECK_IMPLIES(v1, v2)
Definition logging.h:493
#define DCHECK(condition)
Definition logging.h:482