Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
dart::compiler Namespace Reference

Namespaces

namespace  ffi
 
namespace  target
 

Classes

class  Address
 
class  Arm64Encode
 
class  ArmEncode
 
class  AsmIntrinsifier
 
class  Assembler
 
class  AssemblerBase
 
class  AssemblerBuffer
 
class  AssemblerFixup
 
class  BlockBuilder
 
class  DispatchTableGenerator
 
class  ExternalLabel
 
class  FieldAddress
 
class  GraphIntrinsifier
 
class  Immediate
 
struct  IntrinsicDesc
 
class  Intrinsifier
 
class  InvalidClass
 
class  Label
 
class  LeafRuntimeScope
 
struct  LibraryIntrinsicsDesc
 
class  MicroAssembler
 
class  ObjectPoolBuilder
 
struct  ObjectPoolBuilderEntry
 
class  ObjIndexPair
 
class  Operand
 
class  PatchCodeWithHandle
 
class  RuntimeEntry
 
class  SelectorMap
 
class  StackRegisterScope
 
class  StubCodeCompiler
 
struct  TableSelector
 
class  UnresolvedPcRelativeCall
 

Typedefs

using ParameterInfoArray = GrowableArray< std::pair< Location, Representation > >
 
using UnresolvedPcRelativeCalls = GrowableArray< UnresolvedPcRelativeCall * >
 

Enumerations

enum  {
  H = 1 << 5 , L = 1 << 20 , S = 1 << 20 , W = 1 << 21 ,
  A = 1 << 21 , B = 1 << 22 , D = 1 << 22 , N = 1 << 22 ,
  U = 1 << 23 , P = 1 << 24 , I = 1 << 25 , B0 = 1 ,
  B1 = 1 << 1 , B2 = 1 << 2 , B3 = 1 << 3 , B4 = 1 << 4 ,
  B5 = 1 << 5 , B6 = 1 << 6 , B7 = 1 << 7 , B8 = 1 << 8 ,
  B9 = 1 << 9 , B10 = 1 << 10 , B11 = 1 << 11 , B12 = 1 << 12 ,
  B13 = 1 << 13 , B14 = 1 << 14 , B15 = 1 << 15 , B16 = 1 << 16 ,
  B17 = 1 << 17 , B18 = 1 << 18 , B19 = 1 << 19 , B20 = 1 << 20 ,
  B21 = 1 << 21 , B22 = 1 << 22 , B23 = 1 << 23 , B24 = 1 << 24 ,
  B25 = 1 << 25 , B26 = 1 << 26 , B27 = 1 << 27
}
 
enum  OperandSize {
  kByte , kUnsignedByte , kTwoBytes , kUnsignedTwoBytes ,
  kFourBytes , kUnsignedFourBytes , kEightBytes , kSWord ,
  kDWord , kWordPair , kRegList , kQWord ,
  kObjectBytes = kFourBytes
}
 

Functions

static int Log2OperandSizeBytes (OperandSize os)
 
static bool IsSignedOperand (OperandSize os)
 
static uword NewContents (intptr_t capacity)
 
 ASSEMBLER_TEST_EXTERN (StoreIntoObject)
 
 ASSEMBLER_TEST_GENERATE (InstantiateTypeArgumentsHashKeys, assembler)
 
void EnterTestFrame (Assembler *assembler)
 
void LeaveTestFrame (Assembler *assembler)
 
bool IsSameObject (const Object &a, const Object &b)
 
intptr_t ComputeCallingConvention (Zone *zone, const Function &target, intptr_t argc, std::function< Representation(intptr_t)> argument_rep, bool should_assign_stack_locations, ParameterInfoArray *parameter_info)
 
bool IsEqualType (const AbstractType &a, const AbstractType &b)
 
bool IsDoubleType (const AbstractType &type)
 
bool IsBoolType (const AbstractType &type)
 
bool IsSubtypeOfInt (const AbstractType &type)
 
bool IsSmiType (const AbstractType &type)
 
bool IsInOldSpace (const Object &obj)
 
intptr_t ObjectHash (const Object &obj)
 
const char * ObjectToCString (const Object &obj)
 
void SetToNull (Object *obj)
 
ObjectNewZoneHandle (Zone *zone)
 
ObjectNewZoneHandle (Zone *zone, const Object &obj)
 
const ObjectNullObject ()
 
const ObjectSentinelObject ()
 
const BoolTrueObject ()
 
const BoolFalseObject ()
 
const ObjectEmptyTypeArguments ()
 
const TypeDynamicType ()
 
const TypeObjectType ()
 
const TypeVoidType ()
 
const TypeIntType ()
 
const ClassGrowableObjectArrayClass ()
 
const ClassMintClass ()
 
const ClassDoubleClass ()
 
const ClassFloat32x4Class ()
 
const ClassFloat64x2Class ()
 
const ClassInt32x4Class ()
 
const ClassClosureClass ()
 
const ArrayArgumentsDescriptorBoxed (intptr_t type_args_len, intptr_t num_arguments)
 
bool IsOriginalObject (const Object &object)
 
const StringAllocateString (const char *buffer)
 
bool HasIntegerValue (const dart::Object &object, int64_t *value)
 
int32_t CreateJitCookie ()
 
word TypedDataElementSizeInBytes (classid_t cid)
 
word TypedDataMaxNewSpaceElements (classid_t cid)
 
const FieldLookupMathRandomStateFieldOffset ()
 
const FieldLookupConvertUtf8DecoderScanFlagsField ()
 
word LookupFieldOffsetInBytes (const Field &field)
 
const CodeStubCodeAllocateArray ()
 
const CodeStubCodeSubtype2TestCache ()
 
const CodeStubCodeSubtype3TestCache ()
 
const CodeStubCodeSubtype4TestCache ()
 
const CodeStubCodeSubtype6TestCache ()
 
const CodeStubCodeSubtype7TestCache ()
 
void BailoutWithBranchOffsetError ()
 
template<typename To , typename From >
const To & CastHandle (const From &from)
 
const ObjectToObject (const Code &handle)
 
const ObjectToObject (const Function &handle)
 
static void BuildInstantiateTypeRuntimeCall (Assembler *assembler)
 
static void BuildInstantiateTypeParameterStub (Assembler *assembler, Nullability nullability, bool is_function_parameter)
 
static void EnsureIsTypeOrFunctionTypeOrTypeParameter (Assembler *assembler, Register type_reg, Register scratch_reg)
 
static void BuildTypeParameterTypeTestStub (Assembler *assembler, bool allow_null)
 
static void InvokeTypeCheckFromTypeTestStub (Assembler *assembler, TypeCheckMode mode)
 
static void GenerateBoxFpuValueStub (Assembler *assembler, const dart::Class &cls, const RuntimeEntry &runtime_entry, void(Assembler::*store_value)(FpuRegister, Register, int32_t))
 
static intptr_t SuspendStateFpOffset ()
 
static void CallDartCoreLibraryFunction (Assembler *assembler, intptr_t entry_point_offset_in_thread, intptr_t function_offset_in_object_store, bool uses_args_desc=false)
 
static void GenerateAllocateSuspendState (Assembler *assembler, Label *slow_case, Register result_reg, Register frame_size_reg, Register temp_reg)
 
static void GenerateSubtypeTestCacheLoopBody (Assembler *assembler, int n, Register null_reg, Register cache_entry_reg, Register instance_cid_or_sig_reg, Register instance_type_args_reg, Register parent_fun_type_args_reg, Register delayed_type_args_reg, Label *found, Label *not_found, Label *next_iteration)
 
static void GenerateSubtypeTestCacheHashSearch (Assembler *assembler, int n, Register null_reg, Register cache_entry_reg, Register instance_cid_or_sig_reg, Register instance_type_args_reg, Register parent_fun_type_args_reg, Register delayed_type_args_reg, Register cache_entry_end_reg, Register cache_contents_size_reg, Register probe_distance_reg, const StubCodeCompiler::STCSearchExitGenerator &gen_found, const StubCodeCompiler::STCSearchExitGenerator &gen_not_found)
 
static void GenerateSubtypeTestCacheLinearSearch (Assembler *assembler, int n, Register null_reg, Register cache_entry_reg, Register instance_cid_or_sig_reg, Register instance_type_args_reg, Register parent_fun_type_args_reg, Register delayed_type_args_reg, const StubCodeCompiler::STCSearchExitGenerator &gen_found, const StubCodeCompiler::STCSearchExitGenerator &gen_not_found)
 

Variables

constexpr OperandSize kWordBytes = kFourBytes
 
static const IntrinsicDesc core_intrinsics []
 
static const IntrinsicDesc typed_data_intrinsics []
 
static const IntrinsicDesc developer_intrinsics []
 
static const IntrinsicDesc internal_intrinsics []
 
InvalidClass kWordSize
 
InvalidClass kWordSizeLog2
 
InvalidClass kBitsPerWord
 
InvalidClass kBitsPerWordLog2
 
InvalidClass kWordMin
 
InvalidClass kWordMax
 
InvalidClass kUWordMax
 
InvalidClass kNewObjectAlignmentOffset
 
InvalidClass kOldObjectAlignmentOffset
 
InvalidClass kNewObjectBitPosition
 
InvalidClass kPageSize
 
InvalidClass kPageSizeInWords
 
InvalidClass kPageMask
 
InvalidClass kObjectAlignment
 
InvalidClass kObjectAlignmentLog2
 
InvalidClass kObjectAlignmentMask
 
InvalidClass kSmiBits
 
InvalidClass kSmiMin
 
InvalidClass kSmiMax
 
static constexpr intptr_t kHostWordSize = dart::kWordSize
 
static constexpr intptr_t kHostWordSizeLog2 = dart::kWordSizeLog2
 

Typedef Documentation

◆ ParameterInfoArray

Definition at line 26 of file dart_calling_conventions.h.

◆ UnresolvedPcRelativeCalls

Definition at line 51 of file stub_code_compiler.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
B0 
B1 
B2 
B3 
B4 
B5 
B6 
B7 
B8 
B9 
B10 
B11 
B12 
B13 
B14 
B15 
B16 
B17 
B18 
B19 
B20 
B21 
B22 
B23 
B24 
B25 
B26 
B27 

Definition at line 62 of file assembler_arm.h.

62 {
63 H = 1 << 5, // halfword (or byte)
64 L = 1 << 20, // load (or store)
65 S = 1 << 20, // set condition code (or leave unchanged)
66 W = 1 << 21, // writeback base register (or leave unchanged)
67 A = 1 << 21, // accumulate in multiply instruction (or not)
68 B = 1 << 22, // unsigned byte (or word)
69 D = 1 << 22, // high/lo bit of start of s/d register range
70 N = 1 << 22, // long (or short)
71 U = 1 << 23, // positive (or negative) offset/index
72 P = 1 << 24, // offset/pre-indexed addressing (or post-indexed addressing)
73 I = 1 << 25, // immediate shifter operand (or not)
74
75 B0 = 1,
76 B1 = 1 << 1,
77 B2 = 1 << 2,
78 B3 = 1 << 3,
79 B4 = 1 << 4,
80 B5 = 1 << 5,
81 B6 = 1 << 6,
82 B7 = 1 << 7,
83 B8 = 1 << 8,
84 B9 = 1 << 9,
85 B10 = 1 << 10,
86 B11 = 1 << 11,
87 B12 = 1 << 12,
88 B13 = 1 << 13,
89 B14 = 1 << 14,
90 B15 = 1 << 15,
91 B16 = 1 << 16,
92 B17 = 1 << 17,
93 B18 = 1 << 18,
94 B19 = 1 << 19,
95 B20 = 1 << 20,
96 B21 = 1 << 21,
97 B22 = 1 << 22,
98 B23 = 1 << 23,
99 B24 = 1 << 24,
100 B25 = 1 << 25,
101 B26 = 1 << 26,
102 B27 = 1 << 27,
103};
static void B2(DFData *curr, int width)
static void B1(DFData *curr, int width)
#define W
Definition aaa.cpp:17
#define N
Definition beziers.cpp:19
Definition SkMD5.cpp:130
Definition SkMD5.cpp:134

◆ OperandSize

Enumerator
kByte 
kUnsignedByte 
kTwoBytes 
kUnsignedTwoBytes 
kFourBytes 
kUnsignedFourBytes 
kEightBytes 
kSWord 
kDWord 
kWordPair 
kRegList 
kQWord 
kObjectBytes 

Definition at line 179 of file assembler_base.h.

179 {
180 // Architecture-independent constants.
181 kByte,
183 kTwoBytes, // Halfword (ARM), w(ord) (Intel)
185 kFourBytes, // Word (ARM), l(ong) (Intel)
187 kEightBytes, // DoubleWord (ARM), q(uadword) (Intel)
188 // ARM-specific constants.
189 kSWord,
190 kDWord,
191 // 32-bit ARM specific constants.
192 kWordPair,
193 kRegList,
194 // 64-bit ARM specific constants.
195 kQWord,
196
197#if defined(HAS_SMI_63_BITS)
199#else
201#endif
202};

Function Documentation

◆ AllocateString()

const String & dart::compiler::AllocateString ( const char *  buffer)

Definition at line 235 of file runtime_api.cc.

235 {
236 return String::ZoneHandle(String::New(buffer, dart::Heap::kOld));
237}
@ kOld
Definition heap.h:39
static const uint8_t buffer[]

◆ ArgumentsDescriptorBoxed()

const Array & dart::compiler::ArgumentsDescriptorBoxed ( intptr_t  type_args_len,
intptr_t  num_arguments 
)

Definition at line 220 of file runtime_api.cc.

221 {
222 return Array::ZoneHandle(
223 ArgumentsDescriptor::NewBoxed(type_args_len, num_arguments));
224}

◆ ASSEMBLER_TEST_EXTERN()

dart::compiler::ASSEMBLER_TEST_EXTERN ( StoreIntoObject  )

◆ ASSEMBLER_TEST_GENERATE()

dart::compiler::ASSEMBLER_TEST_GENERATE ( InstantiateTypeArgumentsHashKeys  ,
assembler   
)

Definition at line 73 of file assembler_test.cc.

73 {
74#if defined(TARGET_ARCH_IA32)
75 const Register kArg1Reg = EAX;
76 const Register kArg2Reg = ECX;
77 __ movl(kArg1Reg, Address(ESP, 2 * target::kWordSize));
78 __ movl(kArg2Reg, Address(ESP, 1 * target::kWordSize));
79#else
80 const Register kArg1Reg = CallingConventions::ArgumentRegisters[0];
81 const Register kArg2Reg = CallingConventions::ArgumentRegisters[1];
82#endif
83 __ CombineHashes(kArg1Reg, kArg2Reg);
84 __ FinalizeHash(kArg1Reg, kArg2Reg);
85 __ MoveRegister(CallingConventions::kReturnReg, kArg1Reg);
86 __ Ret();
87}
#define __
uint32_t CombineHashes(uint32_t hash, uint32_t other_hash)
Definition hash.h:12
const Register kArg2Reg
uint32_t FinalizeHash(uint32_t hash, intptr_t hashbits=kBitsPerInt32)
Definition hash.h:20
const Register kArg1Reg

◆ BailoutWithBranchOffsetError()

DART_NORETURN void dart::compiler::BailoutWithBranchOffsetError ( )

Definition at line 328 of file runtime_api.cc.

328 {
329 Thread::Current()->long_jump_base()->Jump(1, Object::branch_offset_error());
330}

◆ BuildInstantiateTypeParameterStub()

static void dart::compiler::BuildInstantiateTypeParameterStub ( Assembler assembler,
Nullability  nullability,
bool  is_function_parameter 
)
static

Definition at line 560 of file stub_code_compiler.cc.

562 {
563 Label runtime_call, return_dynamic, type_parameter_value_is_not_type;
564
565 if (is_function_parameter) {
566 __ CompareObject(InstantiateTypeABI::kFunctionTypeArgumentsReg,
567 TypeArguments::null_object());
568 __ BranchIf(EQUAL, &return_dynamic);
569 __ LoadFieldFromOffset(
570 InstantiateTypeABI::kResultTypeReg, InstantiateTypeABI::kTypeReg,
571 target::TypeParameter::index_offset(), kUnsignedTwoBytes);
572 __ LoadIndexedCompressed(InstantiateTypeABI::kResultTypeReg,
573 InstantiateTypeABI::kFunctionTypeArgumentsReg,
574 target::TypeArguments::types_offset(),
575 InstantiateTypeABI::kResultTypeReg);
576 } else {
577 __ CompareObject(InstantiateTypeABI::kInstantiatorTypeArgumentsReg,
578 TypeArguments::null_object());
579 __ BranchIf(EQUAL, &return_dynamic);
580 __ LoadFieldFromOffset(
581 InstantiateTypeABI::kResultTypeReg, InstantiateTypeABI::kTypeReg,
582 target::TypeParameter::index_offset(), kUnsignedTwoBytes);
583 __ LoadIndexedCompressed(InstantiateTypeABI::kResultTypeReg,
584 InstantiateTypeABI::kInstantiatorTypeArgumentsReg,
585 target::TypeArguments::types_offset(),
586 InstantiateTypeABI::kResultTypeReg);
587 }
588
589 __ LoadClassId(InstantiateTypeABI::kScratchReg,
590 InstantiateTypeABI::kResultTypeReg);
591
592 switch (nullability) {
593 case Nullability::kNonNullable:
594 __ Ret();
595 break;
596 case Nullability::kNullable:
597 __ CompareAbstractTypeNullabilityWith(
598 InstantiateTypeABI::kResultTypeReg,
599 static_cast<int8_t>(Nullability::kNullable),
600 InstantiateTypeABI::kScratchReg);
601 __ BranchIf(NOT_EQUAL, &runtime_call);
602 __ Ret();
603 break;
604 case Nullability::kLegacy:
605 __ CompareAbstractTypeNullabilityWith(
606 InstantiateTypeABI::kResultTypeReg,
607 static_cast<int8_t>(Nullability::kNonNullable),
608 InstantiateTypeABI::kScratchReg);
609 __ BranchIf(EQUAL, &runtime_call);
610 __ Ret();
611 }
612
613 // The TAV was null, so the value of the type parameter is "dynamic".
614 __ Bind(&return_dynamic);
615 __ LoadObject(InstantiateTypeABI::kResultTypeReg, Type::dynamic_type());
616 __ Ret();
617
618 __ Bind(&runtime_call);
620}
#define EQUAL(field)
static void BuildInstantiateTypeRuntimeCall(Assembler *assembler)
#define __

◆ BuildInstantiateTypeRuntimeCall()

static void dart::compiler::BuildInstantiateTypeRuntimeCall ( Assembler assembler)
static

Definition at line 547 of file stub_code_compiler.cc.

547 {
548 __ EnterStubFrame();
549 __ PushObject(Object::null_object());
550 __ PushRegistersInOrder({InstantiateTypeABI::kTypeReg,
551 InstantiateTypeABI::kInstantiatorTypeArgumentsReg,
552 InstantiateTypeABI::kFunctionTypeArgumentsReg});
553 __ CallRuntime(kInstantiateTypeRuntimeEntry, /*argument_count=*/3);
554 __ Drop(3);
555 __ PopRegister(InstantiateTypeABI::kResultTypeReg);
556 __ LeaveStubFrame();
557 __ Ret();
558}

◆ BuildTypeParameterTypeTestStub()

static void dart::compiler::BuildTypeParameterTypeTestStub ( Assembler assembler,
bool  allow_null 
)
static

Definition at line 968 of file stub_code_compiler.cc.

969 {
970 Label done;
971
972 if (allow_null) {
973 __ CompareObject(TypeTestABI::kInstanceReg, NullObject());
974 __ BranchIf(EQUAL, &done, Assembler::kNearJump);
975 }
976
977 auto handle_case = [&](Register tav) {
978 // If the TAV is null, then resolving the type parameter gives the dynamic
979 // type, which is a top type.
980 __ CompareObject(tav, NullObject());
981 __ BranchIf(EQUAL, &done, Assembler::kNearJump);
982 // Resolve the type parameter to its instantiated type and tail call the
983 // instantiated type's TTS.
984 __ LoadFieldFromOffset(TypeTestABI::kScratchReg, TypeTestABI::kDstTypeReg,
985 target::TypeParameter::index_offset(),
986 kUnsignedTwoBytes);
987 __ LoadIndexedCompressed(TypeTestABI::kScratchReg, tav,
988 target::TypeArguments::types_offset(),
989 TypeTestABI::kScratchReg);
990 __ Jump(FieldAddress(
991 TypeTestABI::kScratchReg,
992 target::AbstractType::type_test_stub_entry_point_offset()));
993 };
994
995 Label function_type_param;
996 __ LoadFromSlot(TypeTestABI::kScratchReg, TypeTestABI::kDstTypeReg,
997 Slot::AbstractType_flags());
998 __ BranchIfBit(TypeTestABI::kScratchReg,
999 target::UntaggedTypeParameter::kIsFunctionTypeParameterBit,
1000 NOT_ZERO, &function_type_param, Assembler::kNearJump);
1001 handle_case(TypeTestABI::kInstantiatorTypeArgumentsReg);
1002 __ Bind(&function_type_param);
1003 handle_case(TypeTestABI::kFunctionTypeArgumentsReg);
1004 __ Bind(&done);
1005 __ Ret();
1006}
static void done(const char *config, const char *src, const char *srcOptions, const char *name)
Definition DM.cpp:263
const Object & NullObject()

◆ CallDartCoreLibraryFunction()

static void dart::compiler::CallDartCoreLibraryFunction ( Assembler assembler,
intptr_t  entry_point_offset_in_thread,
intptr_t  function_offset_in_object_store,
bool  uses_args_desc = false 
)
static

Definition at line 1779 of file stub_code_compiler.cc.

1783 {
1784 if (FLAG_precompiled_mode) {
1785 __ Call(Address(THR, entry_point_offset_in_thread));
1786 } else {
1787 __ LoadIsolateGroup(FUNCTION_REG);
1788 __ LoadFromOffset(FUNCTION_REG, FUNCTION_REG,
1789 target::IsolateGroup::object_store_offset());
1790 __ LoadFromOffset(FUNCTION_REG, FUNCTION_REG,
1791 function_offset_in_object_store);
1792 __ LoadCompressedFieldFromOffset(CODE_REG, FUNCTION_REG,
1793 target::Function::code_offset());
1794 if (!uses_args_desc) {
1795 // Load a GC-safe value for the arguments descriptor (unused but tagged).
1796 __ LoadImmediate(ARGS_DESC_REG, 0);
1797 }
1798 __ Call(FieldAddress(FUNCTION_REG, target::Function::entry_point_offset()));
1799 }
1800}

◆ CastHandle()

template<typename To , typename From >
const To & dart::compiler::CastHandle ( const From &  from)

Definition at line 127 of file runtime_api.h.

127 {
128 return reinterpret_cast<const To&>(from);
129}

◆ ClosureClass()

const Class & dart::compiler::ClosureClass ( )

Definition at line 215 of file runtime_api.cc.

215 {
216 auto object_store = IsolateGroup::Current()->object_store();
217 return Class::Handle(object_store->closure_class());
218}

◆ ComputeCallingConvention()

intptr_t dart::compiler::ComputeCallingConvention ( Zone zone,
const Function target,
intptr_t  argc,
std::function< Representation(intptr_t)>  argument_rep,
bool  should_assign_stack_locations,
ParameterInfoArray parameter_info 
)

Definition at line 49 of file dart_calling_conventions.cc.

55 {
56 SimpleAllocator cpu_allocator(DartCallingConvention::kCpuRegistersForArgs);
57 SimpleAllocator fpu_allocator(DartCallingConvention::kFpuRegistersForArgs);
58
59 if (parameter_info != nullptr) {
60 parameter_info->TruncateTo(0);
61 parameter_info->EnsureLength(argc, {});
62 }
63
64 const intptr_t max_arguments_in_registers =
65 !target.IsNull() ? target.MaxNumberOfParametersInRegisters(zone) : 0;
66
67 // First allocate all register parameters and compute the size of
68 // parameters on the stack.
69 intptr_t stack_parameters_size_in_words = 0;
70 for (intptr_t i = 0; i < argc; ++i) {
71 auto rep = argument_rep(i);
72
73 Location location;
74 if (i < max_arguments_in_registers) {
75 switch (rep) {
76 case kUnboxedInt64:
77#if defined(TARGET_ARCH_IS_32_BIT)
78 if (auto [lo_reg, hi_reg] = cpu_allocator.AllocatePair();
79 hi_reg != kNoRegister) {
80 location = Location::Pair(Location::RegisterLocation(lo_reg),
81 Location::RegisterLocation(hi_reg));
82#else
83 if (auto reg = cpu_allocator.Allocate(); reg != kNoRegister) {
84 location = Location::RegisterLocation(reg);
85#endif
86 }
87 break;
88
89 case kUnboxedDouble:
90 if (auto reg = fpu_allocator.Allocate(); reg != kNoFpuRegister) {
91 location = Location::FpuRegisterLocation(reg);
92 }
93 break;
94
95 case kTagged:
96 if (auto reg = cpu_allocator.Allocate(); reg != kNoRegister) {
97 location = Location::RegisterLocation(reg);
98 }
99 break;
100
101 default:
102 UNREACHABLE();
103 break;
104 }
105 }
106
107 if (location.IsInvalid()) {
108 intptr_t size_in_words;
109 switch (rep) {
110 case kUnboxedInt64:
111 size_in_words = compiler::target::kIntSpillFactor;
112 break;
113
114 case kUnboxedDouble:
115 size_in_words = compiler::target::kDoubleSpillFactor;
116 break;
117
118 case kTagged:
119 size_in_words = 1;
120 break;
121
122 default:
123 UNREACHABLE();
124 break;
125 }
126 stack_parameters_size_in_words += size_in_words;
127 }
128
129 if (parameter_info != nullptr) {
130 (*parameter_info)[i] = {location, rep};
131 }
132 }
133
134 if (parameter_info == nullptr || !should_assign_stack_locations) {
135 return stack_parameters_size_in_words;
136 }
137
138 // Now that we allocated all register parameters, allocate all other
139 // parameters to the stack.
140 const intptr_t offset_to_last_parameter_slot_from_fp =
141 (compiler::target::frame_layout.param_end_from_fp + 1);
142 intptr_t offset_in_words_from_fp = offset_to_last_parameter_slot_from_fp;
143 for (intptr_t i = argc - 1; i >= 0; --i) {
144 auto& [location, representation] = (*parameter_info)[i];
145 if (!location.IsInvalid()) {
146 continue; // Already allocated to a register.
147 }
148
149 switch (representation) {
150 case kUnboxedInt64:
151 if (compiler::target::kIntSpillFactor == 1) {
152 location = Location::StackSlot(offset_in_words_from_fp, FPREG);
153 } else {
154 ASSERT(compiler::target::kIntSpillFactor == 2);
155 location = Location::Pair(
156 Location::StackSlot(offset_in_words_from_fp, FPREG),
157 Location::StackSlot(offset_in_words_from_fp + 1, FPREG));
158 }
159 offset_in_words_from_fp += compiler::target::kIntSpillFactor;
160 break;
161
162 case kUnboxedDouble:
163 location = Location::DoubleStackSlot(offset_in_words_from_fp, FPREG);
164 offset_in_words_from_fp += compiler::target::kDoubleSpillFactor;
165 break;
166
167 case kTagged:
168 location = Location::StackSlot(offset_in_words_from_fp, FPREG);
169 offset_in_words_from_fp += 1;
170 break;
171
172 default:
173 UNREACHABLE();
174 break;
175 }
176 }
177
179 (offset_in_words_from_fp - offset_to_last_parameter_slot_from_fp) ==
180 stack_parameters_size_in_words);
181
182 return stack_parameters_size_in_words;
183}
#define UNREACHABLE()
Definition assert.h:248
#define RELEASE_ASSERT(cond)
Definition assert.h:327
void TruncateTo(intptr_t length)
void EnsureLength(intptr_t new_length, const T &default_value)
#define ASSERT(E)
uint32_t * target
@ kNoRegister

◆ CreateJitCookie()

int32_t dart::compiler::CreateJitCookie ( )

Definition at line 247 of file runtime_api.cc.

247 {
248 return static_cast<int32_t>(IsolateGroup::Current()->random()->NextUInt32());
249}

◆ DoubleClass()

const Class & dart::compiler::DoubleClass ( )

Definition at line 195 of file runtime_api.cc.

195 {
196 auto object_store = IsolateGroup::Current()->object_store();
197 return Class::Handle(object_store->double_class());
198}

◆ DynamicType()

const Type & dart::compiler::DynamicType ( )

Definition at line 169 of file runtime_api.cc.

169 {
170 return dart::Type::dynamic_type();
171}

◆ EmptyTypeArguments()

const Object & dart::compiler::EmptyTypeArguments ( )

Definition at line 165 of file runtime_api.cc.

165 {
166 return Object::empty_type_arguments();
167}

◆ EnsureIsTypeOrFunctionTypeOrTypeParameter()

static void dart::compiler::EnsureIsTypeOrFunctionTypeOrTypeParameter ( Assembler assembler,
Register  type_reg,
Register  scratch_reg 
)
static

Definition at line 676 of file stub_code_compiler.cc.

678 {
679#if defined(DEBUG)
680 compiler::Label is_type_param_or_type_or_function_type;
681 __ LoadClassIdMayBeSmi(scratch_reg, type_reg);
682 __ CompareImmediate(scratch_reg, kTypeParameterCid);
683 __ BranchIf(EQUAL, &is_type_param_or_type_or_function_type,
684 compiler::Assembler::kNearJump);
685 __ CompareImmediate(scratch_reg, kTypeCid);
686 __ BranchIf(EQUAL, &is_type_param_or_type_or_function_type,
687 compiler::Assembler::kNearJump);
688 __ CompareImmediate(scratch_reg, kFunctionTypeCid);
689 __ BranchIf(EQUAL, &is_type_param_or_type_or_function_type,
690 compiler::Assembler::kNearJump);
691 __ Stop("not a type or function type or type parameter");
692 __ Bind(&is_type_param_or_type_or_function_type);
693#endif
694}

◆ EnterTestFrame()

void dart::compiler::EnterTestFrame ( Assembler assembler)

◆ FalseObject()

const Bool & dart::compiler::FalseObject ( )

Definition at line 161 of file runtime_api.cc.

161 {
162 return dart::Bool::False();
163}
static const Bool & False()
Definition object.h:10778

◆ Float32x4Class()

const Class & dart::compiler::Float32x4Class ( )

Definition at line 200 of file runtime_api.cc.

200 {
201 auto object_store = IsolateGroup::Current()->object_store();
202 return Class::Handle(object_store->float32x4_class());
203}

◆ Float64x2Class()

const Class & dart::compiler::Float64x2Class ( )

Definition at line 205 of file runtime_api.cc.

205 {
206 auto object_store = IsolateGroup::Current()->object_store();
207 return Class::Handle(object_store->float64x2_class());
208}

◆ GenerateAllocateSuspendState()

static void dart::compiler::GenerateAllocateSuspendState ( Assembler assembler,
Label slow_case,
Register  result_reg,
Register  frame_size_reg,
Register  temp_reg 
)
static

Definition at line 1812 of file stub_code_compiler.cc.

1816 {
1817 if (FLAG_use_slow_path || !FLAG_inline_alloc) {
1818 __ Jump(slow_case);
1819 return;
1820 }
1821
1822 // Check for allocation tracing.
1824 __ MaybeTraceAllocation(kSuspendStateCid, slow_case, temp_reg));
1825
1826 // Compute the rounded instance size.
1827 const intptr_t fixed_size_plus_alignment_padding =
1828 (target::SuspendState::HeaderSize() +
1829 target::SuspendState::FrameSizeGrowthGap() * target::kWordSize +
1830 target::ObjectAlignment::kObjectAlignment - 1);
1831 __ AddImmediate(temp_reg, frame_size_reg, fixed_size_plus_alignment_padding);
1832 __ AndImmediate(temp_reg, -target::ObjectAlignment::kObjectAlignment);
1833
1834 // Now allocate the object.
1835 __ LoadFromOffset(result_reg, THR, target::Thread::top_offset());
1836 __ AddRegisters(temp_reg, result_reg);
1837 // Check if the allocation fits into the remaining space.
1838 __ CompareWithMemoryValue(temp_reg,
1839 Address(THR, target::Thread::end_offset()));
1840 __ BranchIf(UNSIGNED_GREATER_EQUAL, slow_case);
1841 __ CheckAllocationCanary(result_reg);
1842
1843 // Successfully allocated the object, now update top to point to
1844 // next object start and initialize the object.
1845 __ StoreToOffset(temp_reg, THR, target::Thread::top_offset());
1846 __ SubRegisters(temp_reg, result_reg);
1847 __ AddImmediate(result_reg, kHeapObjectTag);
1848
1849 if (!FLAG_precompiled_mode) {
1850 // Use rounded object size to calculate and save frame capacity.
1851 __ AddImmediate(temp_reg, temp_reg,
1852 -target::SuspendState::payload_offset());
1853 __ StoreFieldToOffset(temp_reg, result_reg,
1854 target::SuspendState::frame_capacity_offset());
1855 // Restore rounded object size.
1856 __ AddImmediate(temp_reg, temp_reg, target::SuspendState::payload_offset());
1857 }
1858
1859 // Calculate the size tag.
1860 {
1861 Label size_tag_overflow, done;
1862 __ CompareImmediate(temp_reg, target::UntaggedObject::kSizeTagMaxSizeTag);
1863 __ BranchIf(UNSIGNED_GREATER, &size_tag_overflow, Assembler::kNearJump);
1864 __ LslImmediate(temp_reg,
1865 target::UntaggedObject::kTagBitsSizeTagPos -
1866 target::ObjectAlignment::kObjectAlignmentLog2);
1867 __ Jump(&done, Assembler::kNearJump);
1868
1869 __ Bind(&size_tag_overflow);
1870 // Set overflow size tag value.
1871 __ LoadImmediate(temp_reg, 0);
1872
1873 __ Bind(&done);
1874 uword tags = target::MakeTagWordForNewSpaceObject(kSuspendStateCid, 0);
1875 __ OrImmediate(temp_reg, tags);
1876 __ StoreFieldToOffset(temp_reg, result_reg,
1877 target::Object::tags_offset()); // Tags.
1878 }
1879
1880 __ StoreFieldToOffset(frame_size_reg, result_reg,
1881 target::SuspendState::frame_size_offset());
1882}
#define NOT_IN_PRODUCT(code)
Definition globals.h:84

◆ GenerateBoxFpuValueStub()

static void dart::compiler::GenerateBoxFpuValueStub ( Assembler assembler,
const dart::Class cls,
const RuntimeEntry runtime_entry,
void(Assembler::*)(FpuRegister, Register, int32_t)  store_value 
)
static

Definition at line 1708 of file stub_code_compiler.cc.

1713 {
1714 Label call_runtime;
1715 if (!FLAG_use_slow_path && FLAG_inline_alloc) {
1716 __ TryAllocate(cls, &call_runtime, compiler::Assembler::kFarJump,
1717 BoxDoubleStubABI::kResultReg, BoxDoubleStubABI::kTempReg);
1718 (assembler->*store_value)(
1719 BoxDoubleStubABI::kValueReg, BoxDoubleStubABI::kResultReg,
1720 compiler::target::Double::value_offset() - kHeapObjectTag);
1721 __ Ret();
1722 }
1723 __ Bind(&call_runtime);
1724 __ EnterStubFrame();
1725 __ PushObject(NullObject()); /* Make room for result. */
1726 (assembler->*store_value)(BoxDoubleStubABI::kValueReg, THR,
1727 target::Thread::unboxed_runtime_arg_offset());
1728 __ CallRuntime(runtime_entry, 0);
1729 __ PopRegister(BoxDoubleStubABI::kResultReg);
1730 __ LeaveStubFrame();
1731 __ Ret();
1732}
@ kHeapObjectTag

◆ GenerateSubtypeTestCacheHashSearch()

static void dart::compiler::GenerateSubtypeTestCacheHashSearch ( Assembler assembler,
int  n,
Register  null_reg,
Register  cache_entry_reg,
Register  instance_cid_or_sig_reg,
Register  instance_type_args_reg,
Register  parent_fun_type_args_reg,
Register  delayed_type_args_reg,
Register  cache_entry_end_reg,
Register  cache_contents_size_reg,
Register  probe_distance_reg,
const StubCodeCompiler::STCSearchExitGenerator gen_found,
const StubCodeCompiler::STCSearchExitGenerator gen_not_found 
)
static

Definition at line 2776 of file stub_code_compiler.cc.

2789 {
2790 // Since the test entry size is a power of 2, we can use shr to divide.
2791 const intptr_t kTestEntryLengthLog2 =
2792 Utils::ShiftForPowerOfTwo(target::SubtypeTestCache::kTestEntryLength);
2793
2794 // Before we finish calculating the initial probe entry, we'll need the
2795 // starting cache entry and the number of entries. We'll store these in
2796 // [cache_contents_size_reg] and [probe_distance_reg] (or their equivalent
2797 // stack slots), respectively.
2798 __ Comment("Hash cache traversal");
2799 __ Comment("Calculating number of entries");
2800 // The array length is a Smi so it needs to be untagged.
2801 __ SmiUntag(TypeTestABI::kScratchReg);
2802 __ LsrImmediate(TypeTestABI::kScratchReg, kTestEntryLengthLog2);
2803 if (probe_distance_reg != kNoRegister) {
2804 __ MoveRegister(probe_distance_reg, TypeTestABI::kScratchReg);
2805 } else {
2806 __ PushRegister(TypeTestABI::kScratchReg);
2807 }
2808
2809 __ Comment("Calculating starting entry address");
2810 __ AddImmediate(cache_entry_reg,
2811 target::Array::data_offset() - kHeapObjectTag);
2812 if (cache_contents_size_reg != kNoRegister) {
2813 __ MoveRegister(cache_contents_size_reg, cache_entry_reg);
2814 } else {
2815 __ PushRegister(cache_entry_reg);
2816 }
2817
2818 __ Comment("Calculating end of entries address");
2819 __ LslImmediate(TypeTestABI::kScratchReg,
2820 kTestEntryLengthLog2 + target::kCompressedWordSizeLog2);
2821 __ AddRegisters(TypeTestABI::kScratchReg, cache_entry_reg);
2822 if (cache_entry_end_reg != kNoRegister) {
2823 __ MoveRegister(cache_entry_end_reg, TypeTestABI::kScratchReg);
2824 } else {
2825 __ PushRegister(TypeTestABI::kScratchReg);
2826 }
2827
2828 // At this point, the stack is in the following order, if the corresponding
2829 // value doesn't have a register assignment:
2830 // <number of total entries in cache array>
2831 // <cache array entries start>
2832 // <cache array entries end>
2833 // --------- top of stack
2834 //
2835 // and after calculating the initial entry, we'll replace them as follows:
2836 // <probe distance>
2837 // <-cache array contents size> (note this is _negative_)
2838 // <cache array entries end>
2839 // ---------- top of stack
2840 //
2841 // So name them according to their later use.
2842 intptr_t kProbeDistanceDepth = StackRegisterScope::kNoDepth;
2843 intptr_t kHashStackElements = 0;
2844 if (probe_distance_reg == kNoRegister) {
2845 kProbeDistanceDepth = 0;
2846 kHashStackElements++;
2847 }
2848 intptr_t kCacheContentsSizeDepth = StackRegisterScope::kNoDepth;
2849 if (cache_contents_size_reg == kNoRegister) {
2850 kProbeDistanceDepth++;
2851 kHashStackElements++;
2852 kCacheContentsSizeDepth = 0;
2853 }
2854 intptr_t kCacheArrayEndDepth = StackRegisterScope::kNoDepth;
2855 if (cache_entry_end_reg == kNoRegister) {
2856 kProbeDistanceDepth++;
2857 kCacheContentsSizeDepth++;
2858 kHashStackElements++;
2859 kCacheArrayEndDepth = 0;
2860 }
2861
2862 // After this point, any exits should go through one of these two labels,
2863 // which will pop the extra stack elements pushed above.
2864 Label found, not_found;
2865
2866 // When retrieving hashes from objects below, note that a hash of 0 means
2867 // the hash hasn't been computed yet and we need to go to runtime.
2868 auto get_abstract_type_hash = [&](Register dst, Register src,
2869 const char* name) {
2870 ASSERT(dst != kNoRegister);
2871 ASSERT(src != kNoRegister);
2872 __ Comment("Loading %s type hash", name);
2873 __ LoadFromSlot(dst, src, Slot::AbstractType_hash());
2874 __ SmiUntag(dst);
2875 __ CompareImmediate(dst, 0);
2876 __ BranchIf(EQUAL, &not_found);
2877 };
2878 auto get_type_arguments_hash = [&](Register dst, Register src,
2879 const char* name) {
2880 ASSERT(dst != kNoRegister);
2881 ASSERT(src != kNoRegister);
2882 Label done;
2883 __ Comment("Loading %s type arguments hash", name);
2884 // Preload the hash value for TypeArguments::null() so control can jump
2885 // to done if null.
2886 __ LoadImmediate(dst, TypeArguments::kAllDynamicHash);
2887 __ CompareRegisters(src, null_reg);
2888 __ BranchIf(EQUAL, &done, Assembler::kNearJump);
2889 __ LoadFromSlot(dst, src, Slot::TypeArguments_hash());
2890 __ SmiUntag(dst);
2891 __ CompareImmediate(dst, 0);
2892 __ BranchIf(EQUAL, &not_found);
2893 __ Bind(&done);
2894 };
2895
2896 __ Comment("Hash the entry inputs");
2897 {
2898 Label done;
2899 // Assume a Smi tagged instance cid to avoid a branch in the common case.
2900 __ MoveRegister(cache_entry_reg, instance_cid_or_sig_reg);
2901 __ SmiUntag(cache_entry_reg);
2902 __ BranchIfSmi(instance_cid_or_sig_reg, &done, Assembler::kNearJump);
2903 get_abstract_type_hash(cache_entry_reg, instance_cid_or_sig_reg,
2904 "closure signature");
2905 __ Bind(&done);
2906 }
2907 if (n >= 7) {
2908 get_abstract_type_hash(TypeTestABI::kScratchReg, TypeTestABI::kDstTypeReg,
2909 "destination");
2910 __ CombineHashes(cache_entry_reg, TypeTestABI::kScratchReg);
2911 }
2912 if (n >= 6) {
2913 get_type_arguments_hash(TypeTestABI::kScratchReg, delayed_type_args_reg,
2914 "delayed");
2915 __ CombineHashes(cache_entry_reg, TypeTestABI::kScratchReg);
2916 }
2917 if (n >= 5) {
2918 get_type_arguments_hash(TypeTestABI::kScratchReg, parent_fun_type_args_reg,
2919 "parent function");
2920 __ CombineHashes(cache_entry_reg, TypeTestABI::kScratchReg);
2921 }
2922 if (n >= 4) {
2923 get_type_arguments_hash(TypeTestABI::kScratchReg,
2924 TypeTestABI::kFunctionTypeArgumentsReg, "function");
2925 __ CombineHashes(cache_entry_reg, TypeTestABI::kScratchReg);
2926 }
2927 if (n >= 3) {
2928 get_type_arguments_hash(TypeTestABI::kScratchReg,
2929 TypeTestABI::kInstantiatorTypeArgumentsReg,
2930 "instantiator");
2931 __ CombineHashes(cache_entry_reg, TypeTestABI::kScratchReg);
2932 }
2933 if (n >= 2) {
2934 get_type_arguments_hash(TypeTestABI::kScratchReg, instance_type_args_reg,
2935 "instance");
2936 __ CombineHashes(cache_entry_reg, TypeTestABI::kScratchReg);
2937 }
2938 __ FinalizeHash(cache_entry_reg);
2939
2940 // This requires the number of entries in a hash cache to be a power of 2.
2941 __ Comment("Converting hash to probe entry index");
2942 {
2943 StackRegisterScope scope(assembler, &probe_distance_reg,
2944 kProbeDistanceDepth, TypeTestABI::kScratchReg);
2945 // The entry count is not needed after this point; create the mask in place.
2946 __ AddImmediate(probe_distance_reg, -1);
2947 __ AndRegisters(cache_entry_reg, probe_distance_reg);
2948 // Now set the register to the initial probe distance in words.
2949 __ Comment("Set initial probe distance");
2950 __ LoadImmediate(probe_distance_reg,
2951 target::kCompressedWordSize *
2952 target::SubtypeTestCache::kTestEntryLength);
2953 }
2954
2955 // Now cache_entry_reg is the starting probe entry index.
2956 __ Comment("Converting probe entry index to probe entry address");
2957 {
2958 StackRegisterScope scope(assembler, &cache_contents_size_reg,
2959 kCacheContentsSizeDepth, TypeTestABI::kScratchReg);
2960 __ LslImmediate(cache_entry_reg,
2961 kTestEntryLengthLog2 + target::kCompressedWordSizeLog2);
2962 __ AddRegisters(cache_entry_reg, cache_contents_size_reg);
2963 // Now set the register to the negated size of the cache contents in words.
2964 __ Comment("Set negated cache contents size");
2965 if (cache_entry_end_reg != kNoRegister) {
2966 __ SubRegisters(cache_contents_size_reg, cache_entry_end_reg);
2967 } else {
2968 __ LoadFromStack(TMP, kCacheArrayEndDepth);
2969 __ SubRegisters(cache_contents_size_reg, TMP);
2970 }
2971 }
2972
2973 Label loop, next_iteration;
2974 __ Bind(&loop);
2976 assembler, n, null_reg, cache_entry_reg, instance_cid_or_sig_reg,
2977 instance_type_args_reg, parent_fun_type_args_reg, delayed_type_args_reg,
2978 &found, &not_found, &next_iteration);
2979 __ Bind(&next_iteration);
2980 __ Comment("Move to next entry");
2981 {
2982 StackRegisterScope scope(assembler, &probe_distance_reg,
2983 kProbeDistanceDepth, TypeTestABI::kScratchReg);
2984 __ AddRegisters(cache_entry_reg, probe_distance_reg);
2985 __ Comment("Adjust probe distance");
2986 __ AddImmediate(probe_distance_reg,
2987 target::kCompressedWordSize *
2988 target::SubtypeTestCache::kTestEntryLength);
2989 }
2990 __ Comment("Check for leaving array");
2991 // Make sure we haven't run off the array.
2992 if (cache_entry_end_reg != kNoRegister) {
2993 __ CompareRegisters(cache_entry_reg, cache_entry_end_reg);
2994 } else {
2995 __ CompareToStack(cache_entry_reg, kCacheArrayEndDepth);
2996 }
2997 __ BranchIf(LESS, &loop, Assembler::kNearJump);
2998 __ Comment("Wrap around to start of entries");
2999 // Add the negated size of the cache contents.
3000 if (cache_contents_size_reg != kNoRegister) {
3001 __ AddRegisters(cache_entry_reg, cache_contents_size_reg);
3002 } else {
3003 __ LoadFromStack(TypeTestABI::kScratchReg, kCacheContentsSizeDepth);
3004 __ AddRegisters(cache_entry_reg, TypeTestABI::kScratchReg);
3005 }
3006 __ Jump(&loop, Assembler::kNearJump);
3007
3008 __ Bind(&found);
3009 __ Comment("Hash found");
3010 __ Drop(kHashStackElements);
3011 gen_found(assembler, n);
3012 __ Bind(&not_found);
3013 __ Comment("Hash not found");
3014 __ Drop(kHashStackElements);
3015 gen_not_found(assembler, n);
3016}
const char * name
Definition fuchsia.cc:50
static void GenerateSubtypeTestCacheLoopBody(Assembler *assembler, int n, Register null_reg, Register cache_entry_reg, Register instance_cid_or_sig_reg, Register instance_type_args_reg, Register parent_fun_type_args_reg, Register delayed_type_args_reg, Label *found, Label *not_found, Label *next_iteration)
dst
Definition cp.py:12

◆ GenerateSubtypeTestCacheLinearSearch()

static void dart::compiler::GenerateSubtypeTestCacheLinearSearch ( Assembler assembler,
int  n,
Register  null_reg,
Register  cache_entry_reg,
Register  instance_cid_or_sig_reg,
Register  instance_type_args_reg,
Register  parent_fun_type_args_reg,
Register  delayed_type_args_reg,
const StubCodeCompiler::STCSearchExitGenerator gen_found,
const StubCodeCompiler::STCSearchExitGenerator gen_not_found 
)
static

Definition at line 3023 of file stub_code_compiler.cc.

3033 {
3034 __ Comment("Linear cache traversal");
3035 __ AddImmediate(cache_entry_reg,
3036 target::Array::data_offset() - kHeapObjectTag);
3037
3038 Label found, not_found, loop, next_iteration;
3039 __ Bind(&loop);
3041 assembler, n, null_reg, cache_entry_reg, instance_cid_or_sig_reg,
3042 instance_type_args_reg, parent_fun_type_args_reg, delayed_type_args_reg,
3043 &found, &not_found, &next_iteration);
3044 __ Bind(&next_iteration);
3045 __ Comment("Next iteration");
3046 __ AddImmediate(
3047 cache_entry_reg,
3048 target::kCompressedWordSize * target::SubtypeTestCache::kTestEntryLength);
3049 __ Jump(&loop, Assembler::kNearJump);
3050
3051 __ Bind(&found);
3052 __ Comment("Linear found");
3053 gen_found(assembler, n);
3054 __ Bind(&not_found);
3055 __ Comment("Linear not found");
3056 gen_not_found(assembler, n);
3057}

◆ GenerateSubtypeTestCacheLoopBody()

static void dart::compiler::GenerateSubtypeTestCacheLoopBody ( Assembler assembler,
int  n,
Register  null_reg,
Register  cache_entry_reg,
Register  instance_cid_or_sig_reg,
Register  instance_type_args_reg,
Register  parent_fun_type_args_reg,
Register  delayed_type_args_reg,
Label found,
Label not_found,
Label next_iteration 
)
static

Definition at line 2614 of file stub_code_compiler.cc.

2624 {
2625 __ Comment("Loop");
2626 // LoadAcquireCompressed assumes the loaded value is a heap object and
2627 // extends it with the heap bits if compressed. However, the entry may be
2628 // a Smi.
2629 //
2630 // Instead, just use LoadAcquire to load the lower bits when compressed and
2631 // only compare the low bits of the loaded value using CompareObjectRegisters.
2632 __ LoadAcquireFromOffset(
2633 TypeTestABI::kScratchReg, cache_entry_reg,
2634 target::kCompressedWordSize *
2635 target::SubtypeTestCache::kInstanceCidOrSignature,
2636 kObjectBytes);
2637 __ CompareObjectRegisters(TypeTestABI::kScratchReg, null_reg);
2638 __ BranchIf(EQUAL, not_found, Assembler::kNearJump);
2639 __ CompareObjectRegisters(TypeTestABI::kScratchReg, instance_cid_or_sig_reg);
2640 if (n == 1) {
2641 __ BranchIf(EQUAL, found, Assembler::kNearJump);
2642 return;
2643 }
2644
2645 __ BranchIf(NOT_EQUAL, next_iteration, Assembler::kNearJump);
2646 __ CompareWithMemoryValue(
2647 instance_type_args_reg,
2648 Address(cache_entry_reg,
2649 target::kCompressedWordSize *
2650 target::SubtypeTestCache::kInstanceTypeArguments),
2651 kObjectBytes);
2652 if (n == 2) {
2653 __ BranchIf(EQUAL, found, Assembler::kNearJump);
2654 return;
2655 }
2656
2657 __ BranchIf(NOT_EQUAL, next_iteration, Assembler::kNearJump);
2658 __ CompareWithMemoryValue(
2659 TypeTestABI::kInstantiatorTypeArgumentsReg,
2660 Address(cache_entry_reg,
2661 target::kCompressedWordSize *
2662 target::SubtypeTestCache::kInstantiatorTypeArguments),
2663 kObjectBytes);
2664 if (n == 3) {
2665 __ BranchIf(EQUAL, found, Assembler::kNearJump);
2666 return;
2667 }
2668
2669 __ BranchIf(NOT_EQUAL, next_iteration, Assembler::kNearJump);
2670 __ CompareWithMemoryValue(
2671 TypeTestABI::kFunctionTypeArgumentsReg,
2672 Address(cache_entry_reg,
2673 target::kCompressedWordSize *
2674 target::SubtypeTestCache::kFunctionTypeArguments),
2675 kObjectBytes);
2676 if (n == 4) {
2677 __ BranchIf(EQUAL, found, Assembler::kNearJump);
2678 return;
2679 }
2680
2681 __ BranchIf(NOT_EQUAL, next_iteration, Assembler::kNearJump);
2682 __ CompareWithMemoryValue(
2683 parent_fun_type_args_reg,
2684 Address(
2685 cache_entry_reg,
2686 target::kCompressedWordSize *
2687 target::SubtypeTestCache::kInstanceParentFunctionTypeArguments),
2688 kObjectBytes);
2689 if (n == 5) {
2690 __ BranchIf(EQUAL, found, Assembler::kNearJump);
2691 return;
2692 }
2693
2694 __ BranchIf(NOT_EQUAL, next_iteration, Assembler::kNearJump);
2695 __ CompareWithMemoryValue(
2696 delayed_type_args_reg,
2697 Address(
2698 cache_entry_reg,
2699 target::kCompressedWordSize *
2700 target::SubtypeTestCache::kInstanceDelayedFunctionTypeArguments),
2701 kObjectBytes);
2702 if (n == 6) {
2703 __ BranchIf(EQUAL, found, Assembler::kNearJump);
2704 return;
2705 }
2706
2707 __ BranchIf(NOT_EQUAL, next_iteration, Assembler::kNearJump);
2708 __ CompareWithMemoryValue(
2709 TypeTestABI::kDstTypeReg,
2710 Address(cache_entry_reg, target::kCompressedWordSize *
2711 target::SubtypeTestCache::kDestinationType),
2712 kObjectBytes);
2713 __ BranchIf(EQUAL, found, Assembler::kNearJump);
2714}

◆ GrowableObjectArrayClass()

const Class & dart::compiler::GrowableObjectArrayClass ( )

Definition at line 185 of file runtime_api.cc.

185 {
186 auto object_store = IsolateGroup::Current()->object_store();
187 return Class::Handle(object_store->growable_object_array_class());
188}

◆ HasIntegerValue()

bool dart::compiler::HasIntegerValue ( const dart::Object object,
int64_t *  value 
)

Definition at line 239 of file runtime_api.cc.

239 {
240 if (object.IsInteger()) {
241 *value = Integer::Cast(object).AsInt64Value();
242 return true;
243 }
244 return false;
245}
uint8_t value

◆ Int32x4Class()

const Class & dart::compiler::Int32x4Class ( )

Definition at line 210 of file runtime_api.cc.

210 {
211 auto object_store = IsolateGroup::Current()->object_store();
212 return Class::Handle(object_store->int32x4_class());
213}

◆ IntType()

const Type & dart::compiler::IntType ( )

Definition at line 181 of file runtime_api.cc.

181 {
182 return Type::Handle(dart::Type::IntType());
183}
static TypePtr IntType()
Definition object.cc:21886

◆ InvokeTypeCheckFromTypeTestStub()

static void dart::compiler::InvokeTypeCheckFromTypeTestStub ( Assembler assembler,
TypeCheckMode  mode 
)
static

Definition at line 1016 of file stub_code_compiler.cc.

1017 {
1018 __ PushObject(NullObject()); // Make room for result.
1019 __ PushRegistersInOrder({TypeTestABI::kInstanceReg, TypeTestABI::kDstTypeReg,
1020 TypeTestABI::kInstantiatorTypeArgumentsReg,
1021 TypeTestABI::kFunctionTypeArgumentsReg});
1022 __ PushObject(NullObject());
1023 __ PushRegister(TypeTestABI::kSubtypeTestCacheReg);
1024 __ PushImmediate(target::ToRawSmi(mode));
1025 __ CallRuntime(kTypeCheckRuntimeEntry, 7);
1026 __ Drop(1); // mode
1027 __ PopRegister(TypeTestABI::kSubtypeTestCacheReg);
1028 __ Drop(1); // dst_name
1029 __ PopRegister(TypeTestABI::kFunctionTypeArgumentsReg);
1030 __ PopRegister(TypeTestABI::kInstantiatorTypeArgumentsReg);
1031 __ PopRegister(TypeTestABI::kDstTypeReg);
1032 __ PopRegister(TypeTestABI::kInstanceReg);
1033 __ Drop(1); // Discard return value.
1034}

◆ IsBoolType()

bool dart::compiler::IsBoolType ( const AbstractType type)

Definition at line 75 of file runtime_api.cc.

75 {
76 return type.IsBoolType();
77}

◆ IsDoubleType()

bool dart::compiler::IsDoubleType ( const AbstractType type)

Definition at line 71 of file runtime_api.cc.

71 {
72 return type.IsDoubleType();
73}

◆ IsEqualType()

bool dart::compiler::IsEqualType ( const AbstractType a,
const AbstractType b 
)

Definition at line 67 of file runtime_api.cc.

67 {
68 return a.Equals(b);
69}
static bool b
struct MyStruct a[10]

◆ IsInOldSpace()

bool dart::compiler::IsInOldSpace ( const Object obj)

Definition at line 101 of file runtime_api.cc.

101 {
102 return obj.IsSmi() || obj.IsOld();
103}
bool IsOld() const
Definition object.h:391

◆ IsOriginalObject()

bool dart::compiler::IsOriginalObject ( const Object object)

Definition at line 226 of file runtime_api.cc.

226 {
227 if (object.IsICData()) {
228 return ICData::Cast(object).IsOriginal();
229 } else if (object.IsField()) {
230 return Field::Cast(object).IsOriginal();
231 }
232 return true;
233}

◆ IsSameObject()

bool dart::compiler::IsSameObject ( const Object a,
const Object b 
)

Definition at line 60 of file runtime_api.cc.

60 {
61 if (a.IsInstance() && b.IsInstance()) {
62 return Instance::Cast(a).IsIdenticalTo(Instance::Cast(b));
63 }
64 return a.ptr() == b.ptr();
65}

◆ IsSignedOperand()

static bool dart::compiler::IsSignedOperand ( OperandSize  os)
inlinestatic

Definition at line 59 of file assembler_arm64.h.

59 {
60 switch (os) {
61 case kByte:
62 case kTwoBytes:
63 case kFourBytes:
64 return true;
65 case kUnsignedByte:
68 case kEightBytes:
69 case kSWord:
70 case kDWord:
71 case kQWord:
72 return false;
73 default:
75 break;
76 }
77 return false;
78}

◆ IsSmiType()

bool dart::compiler::IsSmiType ( const AbstractType type)

Definition at line 84 of file runtime_api.cc.

84 {
85 return type.IsSmiType();
86}

◆ IsSubtypeOfInt()

bool dart::compiler::IsSubtypeOfInt ( const AbstractType type)

Definition at line 79 of file runtime_api.cc.

79 {
80 return type.IsIntType() || type.IsIntegerImplementationType() ||
81 type.IsSmiType() || type.IsMintType();
82}

◆ LeaveTestFrame()

void dart::compiler::LeaveTestFrame ( Assembler assembler)

◆ Log2OperandSizeBytes()

static int dart::compiler::Log2OperandSizeBytes ( OperandSize  os)
inlinestatic

Definition at line 35 of file assembler_arm64.h.

35 {
36 switch (os) {
37 case kByte:
38 case kUnsignedByte:
39 return 0;
40 case kTwoBytes:
42 return 1;
43 case kFourBytes:
45 case kSWord:
46 return 2;
47 case kEightBytes:
48 case kDWord:
49 return 3;
50 case kQWord:
51 return 4;
52 default:
54 break;
55 }
56 return -1;
57}

◆ LookupConvertUtf8DecoderScanFlagsField()

const Field & dart::compiler::LookupConvertUtf8DecoderScanFlagsField ( )

Definition at line 271 of file runtime_api.cc.

271 {
272 const auto& convert_lib =
274 ASSERT(!convert_lib.IsNull());
275 const auto& _utf8decoder_class = dart::Class::Handle(
276 convert_lib.LookupClassAllowPrivate(dart::Symbols::_Utf8Decoder()));
277 ASSERT(!_utf8decoder_class.IsNull());
278 const auto& scan_flags_field = dart::Field::ZoneHandle(
279 _utf8decoder_class.LookupInstanceFieldAllowPrivate(
280 dart::Symbols::_scanFlags()));
281 return scan_flags_field;
282}
static LibraryPtr ConvertLibrary()
Definition object.cc:14830
static Object & Handle()
Definition object.h:407
static Object & ZoneHandle()
Definition object.h:419

◆ LookupFieldOffsetInBytes()

word dart::compiler::LookupFieldOffsetInBytes ( const Field field)

Definition at line 284 of file runtime_api.cc.

284 {
285 return field.TargetOffset();
286}
intptr_t TargetOffset() const
Definition object.h:13220

◆ LookupMathRandomStateFieldOffset()

const Field & dart::compiler::LookupMathRandomStateFieldOffset ( )

Definition at line 260 of file runtime_api.cc.

260 {
261 const auto& math_lib = dart::Library::Handle(dart::Library::MathLibrary());
262 ASSERT(!math_lib.IsNull());
263 const auto& random_class = dart::Class::Handle(
264 math_lib.LookupClassAllowPrivate(dart::Symbols::_Random()));
265 ASSERT(!random_class.IsNull());
266 const auto& state_field = dart::Field::ZoneHandle(
267 random_class.LookupInstanceFieldAllowPrivate(dart::Symbols::_state()));
268 return state_field;
269}
static LibraryPtr MathLibrary()
Definition object.cc:14858

◆ MintClass()

const Class & dart::compiler::MintClass ( )

Definition at line 190 of file runtime_api.cc.

190 {
191 auto object_store = IsolateGroup::Current()->object_store();
192 return Class::Handle(object_store->mint_class());
193}

◆ NewContents()

static uword dart::compiler::NewContents ( intptr_t  capacity)
static

Definition at line 430 of file assembler_base.cc.

430 {
431 Zone* zone = Thread::Current()->zone();
432 uword result = zone->AllocUnsafe(capacity);
433#if defined(DEBUG)
434 // Initialize the buffer with kBreakPointInstruction to force a break
435 // point if we ever execute an uninitialized part of the code buffer.
436 InitializeMemoryWithBreakpoints(result, capacity);
437#endif
438 return result;
439}
void * AllocUnsafe(intptr_t size)
GAsyncResult * result
uintptr_t uword
Definition globals.h:501

◆ NewZoneHandle() [1/2]

Object & dart::compiler::NewZoneHandle ( Zone zone)

Definition at line 141 of file runtime_api.cc.

141 {
142 return Object::ZoneHandle(zone, Object::null());
143}

◆ NewZoneHandle() [2/2]

Object & dart::compiler::NewZoneHandle ( Zone zone,
const Object obj 
)

Definition at line 145 of file runtime_api.cc.

145 {
146 return Object::ZoneHandle(zone, obj.ptr());
147}
ObjectPtr ptr() const
Definition object.h:332

◆ NullObject()

const Object & dart::compiler::NullObject ( )

Definition at line 149 of file runtime_api.cc.

149 {
150 return Object::null_object();
151}

◆ ObjectHash()

intptr_t dart::compiler::ObjectHash ( const Object obj)

Definition at line 105 of file runtime_api.cc.

105 {
106 if (obj.IsNull()) {
107 return kNullIdentityHash;
108 }
109 // TypeArguments should be handled before Instance as TypeArguments extends
110 // Instance and TypeArguments::CanonicalizeHash just returns 0.
111 if (obj.IsTypeArguments()) {
112 return TypeArguments::Cast(obj).Hash();
113 }
114 if (obj.IsInstance()) {
115 return Instance::Cast(obj).CanonicalizeHash();
116 }
117 if (obj.IsCode()) {
118 return Code::Cast(obj).Hash();
119 }
120 if (obj.IsFunction()) {
121 return Function::Cast(obj).Hash();
122 }
123 if (obj.IsField()) {
124 return Field::Cast(obj).Hash();
125 }
126 if (obj.IsICData()) {
127 return ICData::Cast(obj).Hash();
128 }
129 // Unlikely.
130 return obj.GetClassId();
131}
intptr_t GetClassId() const
Definition object.h:341
bool IsNull() const
Definition object.h:363

◆ ObjectToCString()

const char * dart::compiler::ObjectToCString ( const Object obj)

Definition at line 133 of file runtime_api.cc.

133 {
134 return obj.ToCString();
135}
virtual const char * ToCString() const
Definition object.h:366

◆ ObjectType()

const Type & dart::compiler::ObjectType ( )

Definition at line 173 of file runtime_api.cc.

173 {
174 return Type::Handle(dart::Type::ObjectType());
175}
static TypePtr ObjectType()
Definition object.cc:21878

◆ SentinelObject()

const Object & dart::compiler::SentinelObject ( )

Definition at line 153 of file runtime_api.cc.

153 {
154 return Object::sentinel();
155}

◆ SetToNull()

void dart::compiler::SetToNull ( Object obj)

Definition at line 137 of file runtime_api.cc.

137 {
138 *obj = Object::null();
139}

◆ StubCodeAllocateArray()

const Code & dart::compiler::StubCodeAllocateArray ( )

Definition at line 294 of file runtime_api.cc.

294 {
295 return dart::StubCode::AllocateArray();
296}

◆ StubCodeSubtype2TestCache()

const Code & dart::compiler::StubCodeSubtype2TestCache ( )

Definition at line 298 of file runtime_api.cc.

298 {
299 return dart::StubCode::Subtype2TestCache();
300}

◆ StubCodeSubtype3TestCache()

const Code & dart::compiler::StubCodeSubtype3TestCache ( )

Definition at line 302 of file runtime_api.cc.

302 {
303 return dart::StubCode::Subtype3TestCache();
304}

◆ StubCodeSubtype4TestCache()

const Code & dart::compiler::StubCodeSubtype4TestCache ( )

Definition at line 306 of file runtime_api.cc.

306 {
307 return dart::StubCode::Subtype4TestCache();
308}

◆ StubCodeSubtype6TestCache()

const Code & dart::compiler::StubCodeSubtype6TestCache ( )

Definition at line 310 of file runtime_api.cc.

310 {
311 return dart::StubCode::Subtype6TestCache();
312}

◆ StubCodeSubtype7TestCache()

const Code & dart::compiler::StubCodeSubtype7TestCache ( )

Definition at line 314 of file runtime_api.cc.

314 {
315 return dart::StubCode::Subtype7TestCache();
316}

◆ SuspendStateFpOffset()

static intptr_t dart::compiler::SuspendStateFpOffset ( )
static

Definition at line 1773 of file stub_code_compiler.cc.

1773 {
1774 return compiler::target::frame_layout.FrameSlotForVariableIndex(
1775 SuspendState::kSuspendStateVarIndex) *
1776 compiler::target::kWordSize;
1777}

◆ ToObject() [1/2]

const Object & dart::compiler::ToObject ( const Code handle)
inline

Definition at line 173 of file runtime_api.h.

173 {
174 return *reinterpret_cast<const Object*>(&handle);
175}

◆ ToObject() [2/2]

const Object & dart::compiler::ToObject ( const Function handle)
inline

Definition at line 177 of file runtime_api.h.

177 {
178 return *reinterpret_cast<const Object*>(&handle);
179}

◆ TrueObject()

const Bool & dart::compiler::TrueObject ( )

Definition at line 157 of file runtime_api.cc.

157 {
158 return dart::Bool::True();
159}
static const Bool & True()
Definition object.h:10776

◆ TypedDataElementSizeInBytes()

word dart::compiler::TypedDataElementSizeInBytes ( classid_t  cid)

Definition at line 251 of file runtime_api.cc.

251 {
253}
intptr_t ElementSizeInBytes() const
Definition object.h:11505

◆ TypedDataMaxNewSpaceElements()

word dart::compiler::TypedDataMaxNewSpaceElements ( classid_t  cid)

Definition at line 255 of file runtime_api.cc.

255 {
256 return (dart::kNewAllocatableSize - target::TypedData::HeaderSize()) /
258}
word TypedDataElementSizeInBytes(classid_t cid)
static constexpr intptr_t kNewAllocatableSize
Definition spaces.h:54

◆ VoidType()

const Type & dart::compiler::VoidType ( )

Definition at line 177 of file runtime_api.cc.

177 {
178 return dart::Type::void_type();
179}

Variable Documentation

◆ core_intrinsics

const IntrinsicDesc dart::compiler::core_intrinsics[]
static
Initial value:
= {
{nullptr, nullptr},
}
#define DEFINE_INTRINSIC(class_name, function_name, destination, fp)
#define GRAPH_CORE_INTRINSICS_LIST(V)

Definition at line 92 of file intrinsifier.cc.

◆ developer_intrinsics

const IntrinsicDesc dart::compiler::developer_intrinsics[]
static
Initial value:
= {
{nullptr, nullptr},
}
#define DEVELOPER_LIB_INTRINSIC_LIST(V)

Definition at line 104 of file intrinsifier.cc.

104 {
106 {nullptr, nullptr},
107};

◆ internal_intrinsics

const IntrinsicDesc dart::compiler::internal_intrinsics[]
static
Initial value:
= {
{nullptr, nullptr},
}
#define INTERNAL_LIB_INTRINSIC_LIST(V)

Definition at line 109 of file intrinsifier.cc.

109 {
111 {nullptr, nullptr},
112};

◆ kBitsPerWord

InvalidClass dart::compiler::kBitsPerWord
extern

◆ kBitsPerWordLog2

InvalidClass dart::compiler::kBitsPerWordLog2
extern

◆ kHostWordSize

constexpr intptr_t dart::compiler::kHostWordSize = dart::kWordSize
staticconstexpr

Definition at line 90 of file runtime_api.h.

◆ kHostWordSizeLog2

constexpr intptr_t dart::compiler::kHostWordSizeLog2 = dart::kWordSizeLog2
staticconstexpr

Definition at line 91 of file runtime_api.h.

◆ kNewObjectAlignmentOffset

InvalidClass dart::compiler::kNewObjectAlignmentOffset
extern

◆ kNewObjectBitPosition

InvalidClass dart::compiler::kNewObjectBitPosition
extern

◆ kObjectAlignment

InvalidClass dart::compiler::kObjectAlignment
extern

◆ kObjectAlignmentLog2

InvalidClass dart::compiler::kObjectAlignmentLog2
extern

◆ kObjectAlignmentMask

InvalidClass dart::compiler::kObjectAlignmentMask
extern

◆ kOldObjectAlignmentOffset

InvalidClass dart::compiler::kOldObjectAlignmentOffset
extern

◆ kPageMask

InvalidClass dart::compiler::kPageMask
extern

◆ kPageSize

InvalidClass dart::compiler::kPageSize
extern

◆ kPageSizeInWords

InvalidClass dart::compiler::kPageSizeInWords
extern

◆ kSmiBits

InvalidClass dart::compiler::kSmiBits
extern

◆ kSmiMax

InvalidClass dart::compiler::kSmiMax
extern

◆ kSmiMin

InvalidClass dart::compiler::kSmiMin
extern

◆ kUWordMax

InvalidClass dart::compiler::kUWordMax
extern

◆ kWordBytes

constexpr OperandSize dart::compiler::kWordBytes = kFourBytes
constexpr

Definition at line 208 of file assembler_base.h.

◆ kWordMax

InvalidClass dart::compiler::kWordMax
extern

◆ kWordMin

InvalidClass dart::compiler::kWordMin
extern

◆ kWordSize

InvalidClass dart::compiler::kWordSize
extern

◆ kWordSizeLog2

InvalidClass dart::compiler::kWordSizeLog2
extern

◆ typed_data_intrinsics

const IntrinsicDesc dart::compiler::typed_data_intrinsics[]
static
Initial value:
= {
{nullptr, nullptr},
}
#define GRAPH_TYPED_DATA_INTRINSICS_LIST(V)

Definition at line 99 of file intrinsifier.cc.

99 {
101 {nullptr, nullptr},
102};