409 {
410 public:
411 FieldGuardState() : state_(0) {}
412 explicit FieldGuardState(const Field& field);
413
414 intptr_t guarded_cid() const { return GuardedCidBits::decode(state_); }
415 bool is_nullable() const { return IsNullableBit::decode(state_); }
416
417 private:
418 using GuardedCidBits = BitField<int32_t, ClassIdTagType, 0, 20>;
419 using IsNullableBit = BitField<int32_t, bool, GuardedCidBits::kNextBit, 1>;
420
421 const int32_t state_;
422};
423
424
425
426
427
428
429
430
431class Slot :
public ZoneAllocated {
432 public:
433
434 enum class Kind : uint8_t {
435
436#define DECLARE_KIND(ClassName, __, FieldName, ___, ____) \
437 k##ClassName##_##FieldName,
439#undef DECLARE_KIND
440
441
442 kTypeArguments,
443
444
445 kTypeArgumentsIndex,
446
447
448
449 kArrayElement,
450
451
452 kRecordField,
453
454
455
456 kCapturedVariable,
457
458
459 kDartField,
460 };
461
462
463
464 static const Slot& GetLengthFieldForArrayCid(intptr_t array_cid);
465
466
467
468
469
470
471
472 static const Slot& GetTypeArgumentsSlotFor(Thread* thread,
const Class& cls);
473
474
475 static const Slot& GetTypeArgumentsIndexSlot(Thread* thread, intptr_t index);
476
477
478 static const Slot& GetArrayElementSlot(Thread* thread,
479 intptr_t offset_in_bytes);
480
481
482 static const Slot& GetRecordFieldSlot(Thread* thread,
483 intptr_t offset_in_bytes);
484
485
486 static const Slot& GetContextVariableSlotFor(Thread* thread,
487 const LocalVariable& var);
488
489
490 static const Slot&
Get(
const Field& field,
491 const ParsedFunction* parsed_function);
492
493
494#define DEFINE_GETTER(ClassName, __, FieldName, ___, ____) \
495 static const Slot& ClassName##_##FieldName() { \
496 return GetNativeSlot(Kind::k##ClassName##_##FieldName); \
497 }
498
500#undef DEFINE_GETTER
501
502 Kind kind()
const {
return kind_; }
503 bool IsDartField() const { return kind() == Kind::kDartField; }
504 bool IsLocalVariable() const { return kind() == Kind::kCapturedVariable; }
505 bool IsTypeArguments() const { return kind() == Kind::kTypeArguments; }
506 bool IsArgumentOfType() const { return kind() == Kind::kTypeArgumentsIndex; }
507 bool IsArrayElement() const { return kind() == Kind::kArrayElement; }
508 bool IsRecordField() const { return kind() == Kind::kRecordField; }
509 bool IsImmutableLengthSlot() const;
510
511 const char*
Name()
const;
512
513 intptr_t offset_in_bytes() const { return offset_in_bytes_; }
514
515
516
517
518
520
521 bool is_immutable() const { return IsImmutableBit::decode(flags_); }
522
523 bool is_weak()
const {
return IsWeakBit::decode(flags_); }
524
525
526
527 bool is_guarded_field() const { return IsGuardedBit::decode(flags_); }
528
529 bool is_compressed() const { return IsCompressedBit::decode(flags_); }
530
531
532
533 bool may_contain_inner_pointer() const {
534 return MayContainInnerPointerBit::decode(flags_);
535 }
536
537
538 CompileType
type()
const {
return type_; }
539
540 const Field& field() const {
543 return *DataAs<const Field>();
544 }
545
546 bool Equals(
const Slot& other)
const;
548
549 bool IsIdentical(const Slot& other) const { return this == &other; }
550
551 bool IsContextSlot() const {
552 return kind() == Kind::kCapturedVariable || kind() == Kind::kContext_parent;
553 }
554
555 bool is_tagged() const { return !IsNonTaggedBit::decode(flags_); }
556 bool has_untagged_instance() const {
557 return HasUntaggedInstanceBit::decode(flags_);
558 }
559
560 void Write(FlowGraphSerializer*
s)
const;
561 static const Slot&
Read(FlowGraphDeserializer*
d);
562
563 private:
566 intptr_t offset_in_bytes,
567 const void* data,
569 Representation representation,
570 const FieldGuardState& field_guard_state = FieldGuardState())
571 : kind_(kind),
573 offset_in_bytes_(offset_in_bytes),
574 representation_(representation),
575 field_guard_state_(field_guard_state),
578
579 Slot(
const Slot& other)
581 other.flags_,
582 other.offset_in_bytes_,
583 other.data_,
584 other.type_,
585 other.representation_,
586 other.field_guard_state_) {}
587
588 template <typename T>
589 const T* DataAs()
const {
590 return static_cast<const T*
>(data_);
591 }
592
593 static const Slot& GetCanonicalSlot(
594 Thread* thread,
597 intptr_t offset_in_bytes,
598 const void* data,
600 Representation representation,
601 const FieldGuardState& field_guard_state = FieldGuardState());
602
603 static const Slot& GetNativeSlot(
Kind kind);
604
605 const FieldGuardState& field_guard_state() const {
606 return field_guard_state_;
607 }
608
610 const int8_t flags_;
611 const intptr_t offset_in_bytes_;
613
614 const FieldGuardState field_guard_state_;
615
616
617
618
619
620 const void* data_;
621
622 CompileType type_;
623
624 using IsImmutableBit = BitField<decltype(flags_), bool, 0, 1>;
625 using IsWeakBit =
626 BitField<decltype(flags_), bool, IsImmutableBit::kNextBit, 1>;
627 using IsGuardedBit = BitField<decltype(flags_), bool, IsWeakBit::kNextBit, 1>;
628 using IsCompressedBit =
629 BitField<decltype(flags_), bool, IsGuardedBit::kNextBit, 1>;
630
631 using IsNonTaggedBit =
632 BitField<decltype(flags_), bool, IsCompressedBit::kNextBit, 1>;
633 using MayContainInnerPointerBit =
634 BitField<decltype(flags_), bool, IsNonTaggedBit::kNextBit, 1>;
635 using HasUntaggedInstanceBit =
636 BitField<decltype(flags_), bool, MayContainInnerPointerBit::kNextBit, 1>;
637
638 friend class SlotCache;
639};
640
641}
642
643#endif
static SkWeakReturn is_weak(FcPattern *pattern, const char object[], int id)
bool Equals(const SkPath &a, const SkPath &b)
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
FlutterSemanticsFlag flags
const GrXPFactory * Get(SkBlendMode mode)
SK_API bool Read(SkStreamSeekable *src, SkDocumentPage *dstArray, int dstArrayCount, const SkDeserialProcs *=nullptr)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
#define DECLARE_KIND(CN, __, FN, ___, ____)
#define DEFINE_GETTER(ClassName, __, FieldName, ___, ____)
#define NATIVE_SLOTS_LIST(V)