11#include "torque-generated/exported-macros-assembler.h"
33 bool handle_typed_elements_kind);
47 auto string = Parameter<String>(Descriptor::kReceiver);
48 Return(LoadStringLengthAsSmi(
string));
52 auto value = Parameter<JSPrimitiveWrapper>(Descriptor::kReceiver);
54 Return(LoadStringLengthAsSmi(
string));
57void Builtins::Generate_KeyedStoreIC_Megamorphic(
58 compiler::CodeAssemblerState* state) {
62void Builtins::Generate_DefineKeyedOwnIC_Megamorphic(
63 compiler::CodeAssemblerState* state) {
67void Builtins::Generate_StoreIC_NoFeedback(
68 compiler::CodeAssemblerState* state) {
72void Builtins::Generate_DefineNamedOwnIC_NoFeedback(
73 compiler::CodeAssemblerState* state) {
79#define ELEMENTS_KIND_TRANSITIONS(V) \
80 V(PACKED_SMI_ELEMENTS, HOLEY_SMI_ELEMENTS) \
81 V(PACKED_SMI_ELEMENTS, PACKED_DOUBLE_ELEMENTS) \
82 V(PACKED_SMI_ELEMENTS, HOLEY_DOUBLE_ELEMENTS) \
83 V(PACKED_SMI_ELEMENTS, PACKED_ELEMENTS) \
84 V(PACKED_SMI_ELEMENTS, HOLEY_ELEMENTS) \
85 V(HOLEY_SMI_ELEMENTS, HOLEY_DOUBLE_ELEMENTS) \
86 V(HOLEY_SMI_ELEMENTS, HOLEY_ELEMENTS) \
87 V(PACKED_DOUBLE_ELEMENTS, HOLEY_DOUBLE_ELEMENTS) \
88 V(PACKED_DOUBLE_ELEMENTS, PACKED_ELEMENTS) \
89 V(PACKED_DOUBLE_ELEMENTS, HOLEY_ELEMENTS) \
90 V(HOLEY_DOUBLE_ELEMENTS, HOLEY_ELEMENTS) \
91 V(PACKED_ELEMENTS, HOLEY_ELEMENTS)
100 int32_t combined_elements_kinds[] = {
101#define ELEMENTS_KINDS_CASE(FROM, TO) (FROM << kBitsPerByte) | TO,
103#undef ELEMENTS_KINDS_CASE
106#define ELEMENTS_KINDS_CASE(FROM, TO) Label if_##FROM##_##TO(this);
108#undef ELEMENTS_KINDS_CASE
110 Label* elements_kind_labels[] = {
111#define ELEMENTS_KINDS_CASE(FROM, TO) &if_##FROM##_##TO,
113#undef ELEMENTS_KINDS_CASE
115 static_assert(
arraysize(combined_elements_kinds) ==
121 Switch(combined_elements_kind, &if_unknown_type, combined_elements_kinds,
122 elements_kind_labels,
arraysize(combined_elements_kinds));
124#define ELEMENTS_KINDS_CASE(FROM, TO) \
125 BIND(&if_##FROM##_##TO); \
127 case_function(FROM, TO); \
131#undef ELEMENTS_KINDS_CASE
133 BIND(&if_unknown_type);
139#undef ELEMENTS_KIND_TRANSITIONS
152 Comment(
"ElementsTransitionAndStore: store_mode=", store_mode);
156 if (
v8_flags.trace_elements_transitions) {
180TF_BUILTIN(ElementsTransitionAndStore_NoTransitionGrowAndHandleCOW,
185TF_BUILTIN(ElementsTransitionAndStore_NoTransitionIgnoreTypedArrayOOB,
187 Generate_ElementsTransitionAndStore(
198#define ELEMENTS_KINDS(V) \
199 V(PACKED_SMI_ELEMENTS) \
200 V(HOLEY_SMI_ELEMENTS) \
202 V(PACKED_NONEXTENSIBLE_ELEMENTS) \
203 V(PACKED_SEALED_ELEMENTS) \
204 V(SHARED_ARRAY_ELEMENTS) \
206 V(HOLEY_NONEXTENSIBLE_ELEMENTS) \
207 V(HOLEY_SEALED_ELEMENTS) \
208 V(PACKED_DOUBLE_ELEMENTS) \
209 V(HOLEY_DOUBLE_ELEMENTS) \
216 V(FLOAT16_ELEMENTS) \
217 V(FLOAT32_ELEMENTS) \
218 V(FLOAT64_ELEMENTS) \
219 V(UINT8_CLAMPED_ELEMENTS) \
220 V(BIGUINT64_ELEMENTS) \
221 V(BIGINT64_ELEMENTS) \
222 V(RAB_GSAB_UINT8_ELEMENTS) \
223 V(RAB_GSAB_INT8_ELEMENTS) \
224 V(RAB_GSAB_UINT16_ELEMENTS) \
225 V(RAB_GSAB_INT16_ELEMENTS) \
226 V(RAB_GSAB_UINT32_ELEMENTS) \
227 V(RAB_GSAB_INT32_ELEMENTS) \
228 V(RAB_GSAB_FLOAT16_ELEMENTS) \
229 V(RAB_GSAB_FLOAT32_ELEMENTS) \
230 V(RAB_GSAB_FLOAT64_ELEMENTS) \
231 V(RAB_GSAB_UINT8_CLAMPED_ELEMENTS) \
232 V(RAB_GSAB_BIGUINT64_ELEMENTS) \
233 V(RAB_GSAB_BIGINT64_ELEMENTS)
237 bool handle_typed_elements_kind) {
240 int32_t elements_kinds[] = {
241#define ELEMENTS_KINDS_CASE(KIND) KIND,
243#undef ELEMENTS_KINDS_CASE
246#define ELEMENTS_KINDS_CASE(KIND) Label if_##KIND(this);
248#undef ELEMENTS_KINDS_CASE
250 Label* elements_kind_labels[] = {
251#define ELEMENTS_KINDS_CASE(KIND) &if_##KIND,
253#undef ELEMENTS_KINDS_CASE
259 Switch(elements_kind, &if_unknown_type, elements_kinds, elements_kind_labels,
262#define ELEMENTS_KINDS_CASE(KIND) \
265 if (!handle_typed_elements_kind && \
266 IsTypedArrayOrRabGsabTypedArrayElementsKind(KIND)) { \
269 case_function(KIND); \
274#undef ELEMENTS_KINDS_CASE
276 BIND(&if_unknown_type);
294 Comment(
"StoreFastElementStub: store_mode=", store_mode);
305 [=,
this, &miss, &maybe_converted_value](
ElementsKind elements_kind) {
307 context, &maybe_converted_value);
314 maybe_converted_value.value(), slot, vector,
receiver,
key);
326TF_BUILTIN(StoreFastElementIC_NoTransitionIgnoreTypedArrayOOB,
336 auto receiver = Parameter<JSFunction>(Descriptor::kReceiver);
337 auto name = Parameter<Name>(Descriptor::kName);
338 auto slot = Parameter<Smi>(Descriptor::kSlot);
339 auto vector = Parameter<FeedbackVector>(Descriptor::kVector);
340 auto context = Parameter<Context>(Descriptor::kContext);
342 Label miss(
this, Label::kDeferred);
343 Return(LoadJSFunctionPrototype(
receiver, &miss));
346 TailCallRuntime(Runtime::kLoadIC_Miss, context,
receiver, name, slot, vector);
350 auto receiver = Parameter<Object>(Descriptor::kReceiver);
351 auto name = Parameter<Name>(Descriptor::kName);
352 auto value = Parameter<Object>(Descriptor::kValue);
353 auto slot = Parameter<Smi>(Descriptor::kSlot);
354 auto vector = Parameter<FeedbackVector>(Descriptor::kVector);
355 auto context = Parameter<Context>(Descriptor::kContext);
359 TailCallRuntime(Runtime::kStoreGlobalIC_Slow, context, value, slot, vector,
364 auto receiver = Parameter<JSObject>(Descriptor::kReceiver);
365 auto key = Parameter<Object>(Descriptor::kName);
366 auto slot = Parameter<Smi>(Descriptor::kSlot);
367 auto vector = Parameter<HeapObject>(Descriptor::kVector);
368 auto context = Parameter<Context>(Descriptor::kContext);
378 TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context,
receiver,
key, slot,
398 TailCallRuntime(Runtime::kKeyedStoreIC_Miss, context, value, slot, vector,
403 Generate_KeyedStoreIC_SloppyArguments();
406TF_BUILTIN(KeyedStoreIC_SloppyArguments_NoTransitionGrowAndHandleCOW,
408 Generate_KeyedStoreIC_SloppyArguments();
411TF_BUILTIN(KeyedStoreIC_SloppyArguments_NoTransitionIgnoreTypedArrayOOB,
413 Generate_KeyedStoreIC_SloppyArguments();
416TF_BUILTIN(KeyedStoreIC_SloppyArguments_NoTransitionHandleCOW,
418 Generate_KeyedStoreIC_SloppyArguments();
422 auto receiver = Parameter<JSObject>(Descriptor::kReceiver);
423 auto key = Parameter<Object>(Descriptor::kName);
424 auto slot = Parameter<Smi>(Descriptor::kSlot);
425 auto vector = Parameter<HeapObject>(Descriptor::kVector);
426 auto context = Parameter<Context>(Descriptor::kContext);
428 Label if_keyispositivesmi(
this), if_keyisinvalid(
this);
429 Branch(TaggedIsPositiveSmi(
key), &if_keyispositivesmi, &if_keyisinvalid);
430 BIND(&if_keyispositivesmi);
431 TailCallRuntime(Runtime::kLoadElementWithInterceptor, context,
receiver,
key);
433 BIND(&if_keyisinvalid);
434 TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context,
receiver,
key, slot,
439 auto receiver = Parameter<JSObject>(Descriptor::kReceiver);
440 auto key = Parameter<Object>(Descriptor::kName);
441 auto slot = Parameter<Smi>(Descriptor::kSlot);
442 auto vector = Parameter<HeapObject>(Descriptor::kVector);
443 auto context = Parameter<Context>(Descriptor::kContext);
453 TailCallRuntime(Runtime::kKeyedHasIC_Miss, context,
receiver,
key, slot,
459 auto receiver = Parameter<JSObject>(Descriptor::kReceiver);
460 auto key = Parameter<Object>(Descriptor::kName);
461 auto slot = Parameter<Smi>(Descriptor::kSlot);
462 auto vector = Parameter<HeapObject>(Descriptor::kVector);
463 auto context = Parameter<Context>(Descriptor::kContext);
465 Label if_keyispositivesmi(
this), if_keyisinvalid(
this);
466 Branch(TaggedIsPositiveSmi(
key), &if_keyispositivesmi, &if_keyisinvalid);
467 BIND(&if_keyispositivesmi);
468 TailCallRuntime(Runtime::kHasElementWithInterceptor, context,
receiver,
key);
470 BIND(&if_keyisinvalid);
471 TailCallRuntime(Runtime::kKeyedHasIC_Miss, context,
receiver,
key, slot,
#define ELEMENTS_KINDS(V)
#define ELEMENTS_KINDS_CASE(FROM, TO)
#define ELEMENTS_KIND_TRANSITIONS(V)
#define TF_BUILTIN(Name, AssemblerBase)
void TransitionElementsKind(TNode< JSObject > object, TNode< Map > map, ElementsKind from_kind, ElementsKind to_kind, Label *bailout)
void EmitElementStore(TNode< JSObject > object, TNode< Object > key, TNode< Object > value, ElementsKind elements_kind, KeyedAccessStoreMode store_mode, Label *bailout, TNode< Context > context, TVariable< Object > *maybe_converted_value=nullptr)
TNode< Int32T > LoadElementsKind(TNode< HeapObject > object)
TNode< Int32T > LoadMapElementsKind(TNode< Map > map)
static void Generate(compiler::CodeAssemblerState *state)
static void Generate(compiler::CodeAssemblerState *state)
void DispatchByElementsKind(TNode< Int32T > elements_kind, const ElementsKindSwitchCase &case_function, bool handle_typed_elements_kind)
std::function< void(ElementsKind, ElementsKind)> ElementsKindTransitionSwitchCase
void Generate_StoreFastElementIC(KeyedAccessStoreMode store_mode)
std::function< void(ElementsKind)> ElementsKindSwitchCase
void Generate_ElementsTransitionAndStore(KeyedAccessStoreMode store_mode)
void Generate_KeyedStoreIC_SloppyArguments()
HandlerBuiltinsAssembler(compiler::CodeAssemblerState *state)
void DispatchForElementsKindTransition(TNode< Int32T > from_kind, TNode< Int32T > to_kind, const ElementsKindTransitionSwitchCase &case_function)
static void Generate(compiler::CodeAssemblerState *state)
static void Generate(compiler::CodeAssemblerState *state)
void Comment(MessageWithSourceLocation message, Args &&... args)
void Return(TNode< Object > value)
void TailCallRuntime(Runtime::FunctionId function, TNode< Object > context, TArgs... args)
TNode< Int32T > Word32Or(TNode< Int32T > left, TNode< Int32T > right)
TNode< Int32T > Word32Shl(TNode< Int32T > left, TNode< Int32T > right)
void Switch(Node *index, Label *default_label, const int32_t *case_values, Label **case_labels, size_t case_count)
TNode< Int32T > Int32Constant(int32_t value)
TNode< T > Parameter(int value, const SourceLocation &loc=SourceLocation::Current())
ZoneVector< RpoNumber > & result
constexpr int kBitsPerByte
V8_EXPORT_PRIVATE FlagValues v8_flags
bool StoreModeSupportsTypeArray(KeyedAccessStoreMode store_mode)