5#ifndef V8_COMPILER_TURBOSHAFT_MAGLEV_EARLY_LOWERING_REDUCER_INL_H_
6#define V8_COMPILER_TURBOSHAFT_MAGLEV_EARLY_LOWERING_REDUCER_INL_H_
40 __ DeoptimizeIf(
__ IsSmi(input), frame_state,
41 DeoptimizeReason::kWrongInstanceType, feedback);
46 if (first_instance_type == last_instance_type) {
47#if V8_STATIC_ROOTS_BOOL
49 std::optional<RootIndex> expected_index =
51 CHECK(expected_index.has_value());
54 __ DeoptimizeIfNot(
__ TaggedEqual(map,
__ HeapConstant(expected_map)),
55 frame_state, DeoptimizeReason::kWrongInstanceType,
60 V<Word32> instance_type =
__ LoadInstanceTypeField(map);
61 __ DeoptimizeIfNot(
__ Word32Equal(instance_type, first_instance_type),
62 frame_state, DeoptimizeReason::kWrongInstanceType,
67 frame_state, DeoptimizeReason::kWrongInstanceType,
76 __ DeoptimizeIf(
__ IsSmi(
object), frame_state, DeoptimizeReason::kSmi,
81 V<Map> map =
__ LoadMapField(
object);
82 V<Word32> instance_type =
__ LoadInstanceTypeField(map);
91 frame_state, DeoptimizeReason::kWrongMap, feedback);
95 frame_state, DeoptimizeReason::kWrongMap, feedback);
98 __ template LoadField<InternalizedString>(
100 GOTO(done, intern_string);
113 __ DeoptimizeIfNot(
__ ObjectIsString(
object), frame_state,
114 DeoptimizeReason::kNotAString, feedback);
117 __ template HeapConstant<String>(value.object()));
119 __ RootEqual(is_same_string_bool, RootIndex::kFalseValue,
isolate_),
120 frame_state, DeoptimizeReason::kWrongValue, feedback);
128 return __ LoadTaggedField(side_table,
136 property =
__ LoadTaggedField(
137 side_data, ContextSidePropertyCell::kPropertyDetailsRawOffset);
149 if (
v8_flags.script_context_mutable_heap_int32) {
153 result =
__ AllocateHeapNumberWithValue(
154 __ ChangeInt32ToFloat64(
__ LoadHeapInt32Value(heap_number)),
162 result =
__ AllocateHeapNumberWithValue(
178 __ RootEqual(side_data, RootIndex::kUndefinedValue,
isolate_),
179 frame_state, DeoptimizeReason::kWrongValue, feedback);
183 __ TaggedEqual(property,
185 frame_state, DeoptimizeReason::kWrongValue, feedback);
186 if (
v8_flags.script_context_mutable_heap_number) {
190 __ DeoptimizeIfNot(
__ IsSmi(new_value), frame_state,
191 DeoptimizeReason::kWrongValue, feedback);
193 if (
v8_flags.script_context_mutable_heap_int32) {
205 __ HeapConstant(
factory_->heap_number_map())),
206 frame_state, DeoptimizeReason::kWrongValue, feedback);
207 number_value =
__ ChangeFloat64ToInt32OrDeopt(
225 __ TaggedEqual(map,
__ HeapConstant(
factory_->heap_number_map())),
226 frame_state, DeoptimizeReason::kWrongValue, feedback);
244 __ RootEqual(construct_result, RootIndex::kUndefinedValue,
isolate_),
245 done, implicit_receiver);
256 GOTO(done, implicit_receiver);
281 __ CallRuntime_ThrowConstructorReturnedNonObject(
293 IF (
__ Uint32LessThan(index, length_raw)) {
294 GOTO(done,
__ TagSmi(length_raw));
297 __ Word32Add(index, 1);
298 V<Smi> new_length_tagged =
__ TagSmi(new_length_raw);
302 GOTO(done, new_length_tagged);
305 BIND(done, length_tagged);
306 return length_tagged;
312 const MapRef transition_target) {
334 transition_source.elements_kind(), transition_target.
elements_kind());
335 IF (
__ TaggedEqual(map,
__ HeapConstant(transition_source.object()))) {
339 __ CallRuntime_TransitionElementsKind(
349 V<Map> map =
__ LoadMapField(heap_object);
354 return __ Uint32LessThanOrEqual(
356 __ TruncateWordPtrToWord32(
__ BitcastTaggedToWordPtr(map)));
358 static_assert(LAST_JS_RECEIVER_TYPE ==
LAST_TYPE);
359 return __ Uint32LessThanOrEqual(FIRST_JS_RECEIVER_TYPE,
360 __ LoadInstanceTypeField(map));
377 GOTO(loop,
__ LoadMapField(
object));
380 Label<> object_is_direct(
this);
385 V<Word32> instance_type =
__ LoadInstanceTypeField(map);
387 GOTO_IF(
__ Word32Equal(instance_type, JS_PROXY_TYPE), call_runtime);
391 int mask = Map::Bits1::HasNamedInterceptorBit::kMask |
392 Map::Bits1::IsAccessCheckNeededBit::kMask;
397 GOTO(done,
__ CallRuntime_HasInPrototypeChain(
399 lazy_deopt_on_throw,
object, target_proto));
401 GOTO(object_is_direct);
403 BIND(object_is_direct);
408 GOTO_IF(
__ TaggedEqual(proto, target_proto), done, true_bool);
410 GOTO(loop,
__ LoadMapField(proto));
425 Map::Bits3::IsDeprecatedBit::kMask))) {
426 V<Object> object_or_smi =
__ CallRuntime_TryMigrateInstance(
428 __ DeoptimizeIf(
__ ObjectIsSmi(object_or_smi), frame_state,
429 DeoptimizeReason::kInstanceMigrationFailed, feedback);
443 __ template Allocate<PropertyArray>(
447 __ HeapConstant(
factory_->property_array_map()));
450 for (
int i = 0;
i < old_length;
i++) {
451 V<Object> old_value =
__ template LoadField<Object>(
453 __ InitializeField(new_property_array,
460 __ InitializeField(new_property_array,
467 if (old_length == 0) {
471 V<Object> hash_obj =
__ template LoadField<Object>(
480 V<Smi> hash_smi =
__ template LoadField<Smi>(
482 hash =
__ Word32BitwiseAnd(
__ UntagSmi(hash_smi),
489 __ InitializeField(new_property_array,
491 __ TagSmi(length_and_hash));
494 __ FinishInitialization(std::move(new_property_array));
498 initialized_new_property_array);
500 return initialized_new_property_array;
505 int suspend_id,
int bytecode_offset) {
507 generator, JSGeneratorObject::kParametersAndRegistersOffset);
508 for (
int i = 0;
static_cast<size_t>(
i) < parameters_and_registers.
size();
518 JSGeneratorObject::kContinuationOffset);
522 JSGeneratorObject::kInputOrDebugPosOffset);
527 JSGeneratorObject::kContextOffset);
534 V<Word32> instance_type =
__ LoadInstanceTypeField(map);
536 if (first_instance_type == 0) {
537 return __ Uint32LessThanOrEqual(instance_type, last_instance_type);
539 return __ Uint32LessThanOrEqual(
540 __ Word32Sub(instance_type, first_instance_type),
541 last_instance_type - first_instance_type);
#define BIND_LOOP(loop_label,...)
#define GOTO_IF_NOT(cond, label,...)
#define GOTO_IF(cond, label,...)
union v8::internal::@341::BuiltinMetadata::KindSpecificData data
static constexpr int kShift
static Tagged< Smi > SmiMarker()
static Tagged< Smi > MutableInt32()
static Tagged< Smi > Const()
static Tagged< Smi > MutableHeapNumber()
static V8_INLINE constexpr int OffsetOfElementAt(int index)
@ MIN_CONTEXT_EXTENDED_SLOTS
@ CONTEXT_SIDE_TABLE_PROPERTY_INDEX
v8::internal::Factory * factory()
LocalIsolate * AsLocalIsolate()
Handle< Object > root_handle(RootIndex index)
static const int kFieldsAdded
v8::internal::LocalFactory * factory()
static constexpr int SizeFor(int length)
static const int kNoHashSentinel
static constexpr Tagged< Smi > FromInt(int value)
static constexpr int OffsetOfElementAt(int index)
static FieldAccess ForMap(WriteBarrierKind write_barrier=kMapWriteBarrier)
static FieldAccess ForHeapNumberValue()
static FieldAccess ForThinStringActual()
static FieldAccess ForHeapInt32Value()
static FieldAccess ForJSObjectPropertiesOrHash()
static FieldAccess ForMapPrototype()
static FieldAccess ForMapBitField()
static FieldAccess ForMapBitField3()
static FieldAccess ForPropertyArraySlot(int index)
static FieldAccess ForPropertyArrayLengthAndHash()
IndirectHandle< Map > object() const
ElementsKind elements_kind() const
LocalIsolate * local_isolate_
void TransitionElementsKind(V< Object > object, V< Map > map, const ZoneVector< compiler::MapRef > &transition_sources, const MapRef transition_target, Label< Map > &end)
V< Smi > UpdateJSArrayLength(V< Word32 > length_raw, V< JSArray > object, V< Word32 > index)
void CheckValueEqualsString(V< Object > object, InternalizedStringRef value, V< FrameState > frame_state, const FeedbackSource &feedback)
V< Boolean > HasInPrototypeChain(V< Object > object, HeapObjectRef prototype, V< FrameState > frame_state, V< NativeContext > native_context, LazyDeoptOnThrow lazy_deopt_on_throw)
void CheckInstanceType(V< Object > input, V< FrameState > frame_state, const FeedbackSource &feedback, InstanceType first_instance_type, InstanceType last_instance_type, bool check_smi)
void CheckDerivedConstructResult(V< Object > construct_result, V< FrameState > frame_state, V< NativeContext > native_context, LazyDeoptOnThrow lazy_deopt_on_throw)
V< Word32 > CheckInstanceTypeIsInRange(V< Map > map, InstanceType first_instance_type, InstanceType last_instance_type)
V< Object > LoadScriptContextSideData(V< Context > script_context, int index)
V< InternalizedString > CheckedInternalizedString(V< Object > object, V< FrameState > frame_state, bool check_smi, const FeedbackSource &feedback)
void StoreScriptContextSlowPath(V< Context > script_context, V< Object > old_value, V< Object > new_value, V< Object > side_data, V< FrameState > frame_state, const FeedbackSource &feedback, Label<> &done)
V< Object > LoadScriptContextPropertyFromSideData(V< Object > side_data)
V< Object > CheckConstructResult(V< Object > construct_result, V< Object > implicit_receiver)
V< Word32 > JSAnyIsNotPrimitive(V< HeapObject > heap_object)
V< Map > MigrateMapIfNeeded(V< HeapObject > object, V< Map > map, V< FrameState > frame_state, const FeedbackSource &feedback)
V< Object > LoadHeapNumberFromScriptContext(V< Context > script_context, int index, V< HeapNumber > heap_number)
V< PropertyArray > ExtendPropertiesBackingStore(V< PropertyArray > old_property_array, V< JSObject > object, int old_length, V< FrameState > frame_state, const FeedbackSource &feedback)
V< Map > TransitionMultipleElementsKind(V< Object > object, V< Map > map, const ZoneVector< compiler::MapRef > &transition_sources, const MapRef transition_target)
void GeneratorStore(V< Context > context, V< JSGeneratorObject > generator, base::SmallVector< OpIndex, 32 > parameters_and_registers, int suspend_id, int bytecode_offset)
static constexpr MemoryRepresentation AnyTagged()
static constexpr MemoryRepresentation TaggedSigned()
#define TURBOSHAFT_REDUCER_BOILERPLATE(Name)
ZoneVector< RpoNumber > & result
constexpr unsigned CountPopulation(T value)
constexpr Tagged_t kNonJsReceiverMapLimit
V8_INLINE constexpr std::optional< RootIndex > UniqueMapOfInstanceType(InstanceType type)
static const Operator * IntPtrConstant(CommonOperatorBuilder *common, intptr_t value)
const uint32_t kThinStringTagBit
V8_INLINE constexpr bool IsSmi(TaggedImpl< kRefType, StorageType > obj)
const uint32_t kStringTag
bool IsSimpleMapChangeTransition(ElementsKind from_kind, ElementsKind to_kind)
@ LAST_SPECIAL_RECEIVER_TYPE
V8_EXPORT_PRIVATE FlagValues v8_flags
const uint32_t kInternalizedTag
const uint32_t kIsNotInternalizedMask
const uint32_t kIsNotStringMask
!IsContextMap !IsContextMap native_context
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
static constexpr Kind TaggedBase()
#define V8_STATIC_ROOTS_BOOL