Flutter Engine
The Flutter Engine
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)
 
static void EmitCodeFor (FlowGraphCompiler *compiler, FlowGraph *graph)
 
static Representation RepresentationForCid (intptr_t cid)
 
static DefinitionPrepareIndexedOp (FlowGraph *flow_graph, BlockBuilder *builder, Definition *array, Definition *index, const Slot &length_field)
 
static void VerifyParameterIsBoxed (BlockBuilder *builder, intptr_t arg_index)
 
static DefinitionCreateBoxedParameterIfNeeded (BlockBuilder *builder, Definition *value, Representation representation, intptr_t arg_index)
 
static DefinitionCreateBoxedResultIfNeeded (BlockBuilder *builder, Definition *value, Representation representation)
 
static DefinitionCreateUnboxedResultIfNeeded (BlockBuilder *builder, Definition *value)
 
static bool IntrinsifyArraySetIndexed (FlowGraph *flow_graph, intptr_t array_cid)
 
static bool BuildSimdOp (FlowGraph *flow_graph, intptr_t cid, Token::Kind kind)
 
static bool BuildFloat32x4Get (FlowGraph *flow_graph, MethodRecognizer::Kind kind)
 
static bool BuildLoadField (FlowGraph *flow_graph, const Slot &field)
 
static bool BuildUnarySmiOp (FlowGraph *flow_graph, Token::Kind op_kind)
 
static bool BuildBinarySmiOp (FlowGraph *flow_graph, Token::Kind op_kind)
 
static DefinitionConvertOrUnboxDoubleParameter (BlockBuilder *builder, Definition *value, intptr_t index, bool is_checked)
 
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)
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
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126

◆ 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;
79#else
80 const Register kArg1Reg = CallingConventions::ArgumentRegisters[0];
81 const Register kArg2Reg = CallingConventions::ArgumentRegisters[1];
82#endif
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
constexpr intptr_t kWordSize
Definition: globals.h:509
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}

◆ BuildBinarySmiOp()

static bool dart::compiler::BuildBinarySmiOp ( FlowGraph flow_graph,
Token::Kind  op_kind 
)
static

Definition at line 624 of file graph_intrinsifier.cc.

624 {
625 ASSERT(!flow_graph->function().has_unboxed_return());
626 ASSERT(!flow_graph->function().is_unboxed_parameter_at(0));
627 ASSERT(!flow_graph->function().is_unboxed_parameter_at(1));
628 GraphEntryInstr* graph_entry = flow_graph->graph_entry();
629 auto normal_entry = graph_entry->normal_entry();
630 BlockBuilder builder(flow_graph, normal_entry, /*with_frame=*/false);
631 Definition* left = builder.AddParameter(0);
632 Definition* right = builder.AddParameter(1);
633 builder.AddInstruction(
634 new CheckSmiInstr(new Value(left), DeoptId::kNone, builder.Source()));
635 builder.AddInstruction(
636 new CheckSmiInstr(new Value(right), DeoptId::kNone, builder.Source()));
637 Definition* result = builder.AddDefinition(new BinarySmiOpInstr(
638 op_kind, new Value(left), new Value(right), DeoptId::kNone));
639 builder.AddReturn(new Value(result));
640 return true;
641}
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)
GraphEntryInstr * graph_entry() const
Definition: flow_graph.h:268
const Function & function() const
Definition: flow_graph.h:130
bool has_unboxed_return() const
Definition: object.h:3803
bool is_unboxed_parameter_at(intptr_t index) const
Definition: object.h:3773
FunctionEntryInstr * normal_entry() const
Definition: il.h:2001
Definition: il.h:75
#define ASSERT(E)
GAsyncResult * result
@ kNone
Definition: layer.h:53

◆ BuildFloat32x4Get()

static bool dart::compiler::BuildFloat32x4Get ( FlowGraph flow_graph,
MethodRecognizer::Kind  kind 
)
static

Definition at line 399 of file graph_intrinsifier.cc.

400 {
401 if (!FlowGraphCompiler::SupportsUnboxedSimd128()) {
402 return false;
403 }
404 GraphEntryInstr* graph_entry = flow_graph->graph_entry();
405 auto normal_entry = graph_entry->normal_entry();
406 BlockBuilder builder(flow_graph, normal_entry, /*with_frame=*/false);
407
408 Definition* receiver = builder.AddParameter(0);
409
410 const auto& function = flow_graph->function();
411 Definition* unboxed_receiver =
412 !function.is_unboxed_parameter_at(0)
413 ? builder.AddUnboxInstr(kUnboxedFloat32x4, new Value(receiver),
414 /* is_checked = */ true)
415 : receiver;
416
417 Definition* unboxed_result = builder.AddDefinition(
418 SimdOpInstr::Create(kind, new Value(unboxed_receiver), DeoptId::kNone));
419
421 CreateBoxedResultIfNeeded(&builder, unboxed_result, kUnboxedDouble);
422
423 builder.AddReturn(new Value(result));
424 return true;
425}
static sk_sp< Effect > Create()
Definition: RefCntTest.cpp:117
Dart_NativeFunction function
Definition: fuchsia.cc:51
static Definition * CreateBoxedResultIfNeeded(BlockBuilder *builder, Definition *value, Representation representation)

◆ BuildInstantiateTypeParameterStub()

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

Definition at line 569 of file stub_code_compiler.cc.

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

◆ BuildInstantiateTypeRuntimeCall()

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

Definition at line 556 of file stub_code_compiler.cc.

556 {
557 __ EnterStubFrame();
558 __ PushObject(Object::null_object());
559 __ PushRegistersInOrder({InstantiateTypeABI::kTypeReg,
560 InstantiateTypeABI::kInstantiatorTypeArgumentsReg,
561 InstantiateTypeABI::kFunctionTypeArgumentsReg});
562 __ CallRuntime(kInstantiateTypeRuntimeEntry, /*argument_count=*/3);
563 __ Drop(3);
564 __ PopRegister(InstantiateTypeABI::kResultTypeReg);
565 __ LeaveStubFrame();
566 __ Ret();
567}

◆ BuildLoadField()

static bool dart::compiler::BuildLoadField ( FlowGraph flow_graph,
const Slot field 
)
static

Definition at line 443 of file graph_intrinsifier.cc.

443 {
444 GraphEntryInstr* graph_entry = flow_graph->graph_entry();
445 auto normal_entry = graph_entry->normal_entry();
446 BlockBuilder builder(flow_graph, normal_entry, /*with_frame=*/false);
447
448 Definition* array = builder.AddParameter(0);
450
451 Definition* length = builder.AddDefinition(
452 new LoadFieldInstr(new Value(array), field, builder.Source()));
453
455 builder.AddReturn(new Value(length));
456 return true;
457}
size_t length
static void VerifyParameterIsBoxed(BlockBuilder *builder, intptr_t arg_index)
static Definition * CreateUnboxedResultIfNeeded(BlockBuilder *builder, Definition *value)

◆ BuildSimdOp()

static bool dart::compiler::BuildSimdOp ( FlowGraph flow_graph,
intptr_t  cid,
Token::Kind  kind 
)
static

Definition at line 332 of file graph_intrinsifier.cc.

332 {
333 if (!FlowGraphCompiler::SupportsUnboxedSimd128()) return false;
334
335 auto const rep = RepresentationForCid(cid);
336
337 Zone* zone = flow_graph->zone();
338 GraphEntryInstr* graph_entry = flow_graph->graph_entry();
339 auto normal_entry = graph_entry->normal_entry();
340 BlockBuilder builder(flow_graph, normal_entry, /*with_frame=*/false);
341
342 Definition* left = builder.AddParameter(0);
343 Definition* right = builder.AddParameter(1);
344
347
348 Cids* value_check = Cids::CreateMonomorphic(zone, cid);
349 // Check argument. Receiver (left) is known to be a Float32x4.
350 builder.AddInstruction(new CheckClassInstr(new Value(right), DeoptId::kNone,
351 *value_check, builder.Source()));
352 Definition* left_simd = builder.AddUnboxInstr(rep, new Value(left),
353 /* is_checked = */ true);
354
355 Definition* right_simd = builder.AddUnboxInstr(rep, new Value(right),
356 /* is_checked = */ true);
357
358 Definition* unboxed_result = builder.AddDefinition(SimdOpInstr::Create(
359 SimdOpInstr::KindForOperator(cid, kind), new Value(left_simd),
360 new Value(right_simd), DeoptId::kNone));
361 Definition* result = CreateBoxedResultIfNeeded(&builder, unboxed_result, rep);
362
363 builder.AddReturn(new Value(result));
364 return true;
365}
Definition: il.h:736
Zone * zone() const
Definition: flow_graph.h:261
static Representation RepresentationForCid(intptr_t cid)
const intptr_t cid

◆ BuildTypeParameterTypeTestStub()

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

Definition at line 959 of file stub_code_compiler.cc.

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

◆ BuildUnarySmiOp()

static bool dart::compiler::BuildUnarySmiOp ( FlowGraph flow_graph,
Token::Kind  op_kind 
)
static

Definition at line 601 of file graph_intrinsifier.cc.

601 {
602 ASSERT(!flow_graph->function().has_unboxed_return());
603 ASSERT(!flow_graph->function().is_unboxed_parameter_at(0));
604 GraphEntryInstr* graph_entry = flow_graph->graph_entry();
605 auto normal_entry = graph_entry->normal_entry();
606 BlockBuilder builder(flow_graph, normal_entry, /*with_frame=*/false);
607 Definition* left = builder.AddParameter(0);
608 builder.AddInstruction(
609 new CheckSmiInstr(new Value(left), DeoptId::kNone, builder.Source()));
610 Definition* result = builder.AddDefinition(
611 new UnarySmiOpInstr(op_kind, new Value(left), DeoptId::kNone));
612 builder.AddReturn(new Value(result));
613 return true;
614}

◆ 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 1771 of file stub_code_compiler.cc.

1775 {
1776 if (FLAG_precompiled_mode) {
1777 __ Call(Address(THR, entry_point_offset_in_thread));
1778 } else {
1779 __ LoadIsolateGroup(FUNCTION_REG);
1780 __ LoadFromOffset(FUNCTION_REG, FUNCTION_REG,
1781 target::IsolateGroup::object_store_offset());
1782 __ LoadFromOffset(FUNCTION_REG, FUNCTION_REG,
1783 function_offset_in_object_store);
1784 __ LoadCompressedFieldFromOffset(CODE_REG, FUNCTION_REG,
1785 target::Function::code_offset());
1786 if (!uses_args_desc) {
1787 // Load a GC-safe value for the arguments descriptor (unused but tagged).
1788 __ LoadImmediate(ARGS_DESC_REG, 0);
1789 }
1790 __ Call(FieldAddress(FUNCTION_REG, target::Function::entry_point_offset()));
1791 }
1792}
const Register THR
const Register CODE_REG
const Register ARGS_DESC_REG
const Register FUNCTION_REG

◆ 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:
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 =
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:
152 location = Location::StackSlot(offset_in_words_from_fp, FPREG);
153 } else {
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)
uint32_t * target
constexpr intptr_t kDoubleSpillFactor
Definition: runtime_api.h:340
constexpr intptr_t kIntSpillFactor
Definition: runtime_api.h:339
FrameLayout frame_layout
Definition: stack_frame.cc:76
@ kNoRegister
Definition: constants_arm.h:99
const Register FPREG
intptr_t param_end_from_fp
Definition: frame_layout.h:30

◆ ConvertOrUnboxDoubleParameter()

static Definition * dart::compiler::ConvertOrUnboxDoubleParameter ( BlockBuilder builder,
Definition value,
intptr_t  index,
bool  is_checked 
)
static

Definition at line 683 of file graph_intrinsifier.cc.

686 {
687 const auto& function = builder->function();
688 if (function.is_unboxed_double_parameter_at(index)) {
689 return value;
690 } else if (function.is_unboxed_integer_parameter_at(index)) {
692 // Int64ToDoubleInstr is not implemented in 32-bit platforms
693 return nullptr;
694 }
695 auto to_double = new Int64ToDoubleInstr(new Value(value), DeoptId::kNone);
696 return builder->AddDefinition(to_double);
697 } else {
698 ASSERT(!function.is_unboxed_parameter_at(index));
699 return builder->AddUnboxInstr(kUnboxedDouble, value, is_checked);
700 }
701}
uint8_t value

◆ CreateBoxedParameterIfNeeded()

static Definition * dart::compiler::CreateBoxedParameterIfNeeded ( BlockBuilder builder,
Definition value,
Representation  representation,
intptr_t  arg_index 
)
static

Definition at line 175 of file graph_intrinsifier.cc.

178 {
179 const auto& function = builder->function();
180 if (function.is_unboxed_parameter_at(arg_index)) {
181 return builder->AddDefinition(
182 BoxInstr::Create(representation, new Value(value)));
183 } else {
184 return value;
185 }
186}

◆ CreateBoxedResultIfNeeded()

static Definition * dart::compiler::CreateBoxedResultIfNeeded ( BlockBuilder builder,
Definition value,
Representation  representation 
)
static

Definition at line 188 of file graph_intrinsifier.cc.

190 {
191 const auto& function = builder->function();
192 ASSERT(!function.has_unboxed_record_return());
194 if (representation == kUnboxedFloat) {
195 result = builder->AddDefinition(
197 representation = kUnboxedDouble;
198 }
199 if (!function.has_unboxed_return()) {
200 result = builder->AddDefinition(BoxInstr::Create(
201 Boxing::NativeRepresentation(representation), new Value(result)));
202 }
203 return result;
204}

◆ 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}

◆ CreateUnboxedResultIfNeeded()

static Definition * dart::compiler::CreateUnboxedResultIfNeeded ( BlockBuilder builder,
Definition value 
)
static

Definition at line 206 of file graph_intrinsifier.cc.

207 {
208 const auto& function = builder->function();
209 ASSERT(!function.has_unboxed_record_return());
210 if (function.has_unboxed_return() && value->representation() == kTagged) {
211 return builder->AddUnboxInstr(FlowGraph::ReturnRepresentationOf(function),
212 new Value(value), /* is_checked = */ true);
213 } else {
214 return value;
215 }
216}

◆ 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}

◆ EmitCodeFor()

static void dart::compiler::EmitCodeFor ( FlowGraphCompiler compiler,
FlowGraph graph 
)
static

Definition at line 43 of file graph_intrinsifier.cc.

43 {
44 // For graph intrinsics we run the linearscan register allocator, which will
45 // pass opt=true for MakeLocationSummary. We therefore also have to ensure
46 // `compiler->is_optimizing()` is set to true during EmitNativeCode.
47 GraphIntrinsicCodeGenScope optimizing_scope(compiler);
48
49 compiler->assembler()->Comment("Graph intrinsic begin");
50 for (intptr_t i = 0; i < graph->reverse_postorder().length(); i++) {
51 BlockEntryInstr* block = graph->reverse_postorder()[i];
52 if (block->IsGraphEntry()) continue; // No code for graph entry needed.
53
54 if (block->HasParallelMove()) {
56 }
57
58 for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) {
59 Instruction* instr = it.Current();
60 if (FLAG_code_comments) compiler->EmitComment(instr);
61 // Calls are not supported in intrinsics code.
62 ASSERT(instr->IsParallelMove() ||
63 (instr->locs() != nullptr && !instr->locs()->always_calls()));
65 }
66 }
67 compiler->assembler()->Comment("Graph intrinsic end");
68}
ParallelMoveInstr * parallel_move() const
Definition: il.h:1689
bool HasParallelMove() const
Definition: il.h:1691
const GrowableArray< BlockEntryInstr * > & reverse_postorder() const
Definition: flow_graph.h:207
virtual void EmitNativeCode(FlowGraphCompiler *compiler)
Definition: il.h:1213
LocationSummary * locs()
Definition: il.h:1192
bool always_calls() const
Definition: locations.h:918

◆ 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 667 of file stub_code_compiler.cc.

669 {
670#if defined(DEBUG)
671 compiler::Label is_type_param_or_type_or_function_type;
672 __ LoadClassIdMayBeSmi(scratch_reg, type_reg);
673 __ CompareImmediate(scratch_reg, kTypeParameterCid);
674 __ BranchIf(EQUAL, &is_type_param_or_type_or_function_type,
675 compiler::Assembler::kNearJump);
676 __ CompareImmediate(scratch_reg, kTypeCid);
677 __ BranchIf(EQUAL, &is_type_param_or_type_or_function_type,
678 compiler::Assembler::kNearJump);
679 __ CompareImmediate(scratch_reg, kFunctionTypeCid);
680 __ BranchIf(EQUAL, &is_type_param_or_type_or_function_type,
681 compiler::Assembler::kNearJump);
682 __ Stop("not a type or function type or type parameter");
683 __ Bind(&is_type_param_or_type_or_function_type);
684#endif
685}

◆ 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:10799

◆ 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 1804 of file stub_code_compiler.cc.

1808 {
1809 if (FLAG_use_slow_path || !FLAG_inline_alloc) {
1810 __ Jump(slow_case);
1811 return;
1812 }
1813
1814 // Check for allocation tracing.
1816 __ MaybeTraceAllocation(kSuspendStateCid, slow_case, temp_reg));
1817
1818 // Compute the rounded instance size.
1819 const intptr_t fixed_size_plus_alignment_padding =
1821 target::SuspendState::FrameSizeGrowthGap() * target::kWordSize +
1823 __ AddImmediate(temp_reg, frame_size_reg, fixed_size_plus_alignment_padding);
1824 __ AndImmediate(temp_reg, -target::ObjectAlignment::kObjectAlignment);
1825
1826 // Now allocate the object.
1827 __ LoadFromOffset(result_reg, THR, target::Thread::top_offset());
1828 __ AddRegisters(temp_reg, result_reg);
1829 // Check if the allocation fits into the remaining space.
1830 __ CompareWithMemoryValue(temp_reg,
1831 Address(THR, target::Thread::end_offset()));
1832 __ BranchIf(UNSIGNED_GREATER_EQUAL, slow_case);
1833 __ CheckAllocationCanary(result_reg);
1834
1835 // Successfully allocated the object, now update top to point to
1836 // next object start and initialize the object.
1837 __ StoreToOffset(temp_reg, THR, target::Thread::top_offset());
1838 __ SubRegisters(temp_reg, result_reg);
1839 __ AddImmediate(result_reg, kHeapObjectTag);
1840
1841 if (!FLAG_precompiled_mode) {
1842 // Use rounded object size to calculate and save frame capacity.
1843 __ AddImmediate(temp_reg, temp_reg,
1844 -target::SuspendState::payload_offset());
1845 __ StoreFieldToOffset(temp_reg, result_reg,
1846 target::SuspendState::frame_capacity_offset());
1847 // Restore rounded object size.
1848 __ AddImmediate(temp_reg, temp_reg, target::SuspendState::payload_offset());
1849 }
1850
1851 // Calculate the size tag.
1852 {
1853 Label size_tag_overflow, done;
1854 __ CompareImmediate(temp_reg, target::UntaggedObject::kSizeTagMaxSizeTag);
1855 __ BranchIf(UNSIGNED_GREATER, &size_tag_overflow, Assembler::kNearJump);
1856 __ LslImmediate(temp_reg,
1857 target::UntaggedObject::kTagBitsSizeTagPos -
1859 __ Jump(&done, Assembler::kNearJump);
1860
1861 __ Bind(&size_tag_overflow);
1862 // Set overflow size tag value.
1863 __ LoadImmediate(temp_reg, 0);
1864
1865 __ Bind(&done);
1866 uword tags = target::MakeTagWordForNewSpaceObject(kSuspendStateCid, 0);
1867 __ OrImmediate(temp_reg, tags);
1868 __ StoreFieldToOffset(temp_reg, result_reg,
1869 target::Object::tags_offset()); // Tags.
1870 }
1871
1872 __ StoreFieldToOffset(frame_size_reg, result_reg,
1873 target::SuspendState::frame_size_offset());
1874}
uword MakeTagWordForNewSpaceObject(classid_t cid, uword instance_size)
Definition: runtime_api.cc:360
InvalidClass kObjectAlignment
InvalidClass kObjectAlignmentLog2
static constexpr int HeaderSize
uintptr_t uword
Definition: globals.h:501
@ UNSIGNED_GREATER
@ UNSIGNED_GREATER_EQUAL
@ kHeapObjectTag
#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 1700 of file stub_code_compiler.cc.

1705 {
1706 Label call_runtime;
1707 if (!FLAG_use_slow_path && FLAG_inline_alloc) {
1708 __ TryAllocate(cls, &call_runtime, compiler::Assembler::kFarJump,
1709 BoxDoubleStubABI::kResultReg, BoxDoubleStubABI::kTempReg);
1710 (assembler->*store_value)(
1711 BoxDoubleStubABI::kValueReg, BoxDoubleStubABI::kResultReg,
1712 compiler::target::Double::value_offset() - kHeapObjectTag);
1713 __ Ret();
1714 }
1715 __ Bind(&call_runtime);
1716 __ EnterStubFrame();
1717 __ PushObject(NullObject()); /* Make room for result. */
1718 (assembler->*store_value)(BoxDoubleStubABI::kValueReg, THR,
1719 target::Thread::unboxed_runtime_arg_offset());
1720 __ CallRuntime(runtime_entry, 0);
1721 __ PopRegister(BoxDoubleStubABI::kResultReg);
1722 __ LeaveStubFrame();
1723 __ Ret();
1724}

◆ 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 2768 of file stub_code_compiler.cc.

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

3025 {
3026 __ Comment("Linear cache traversal");
3027 __ AddImmediate(cache_entry_reg,
3028 target::Array::data_offset() - kHeapObjectTag);
3029
3030 Label found, not_found, loop, next_iteration;
3031 __ Bind(&loop);
3033 assembler, n, null_reg, cache_entry_reg, instance_cid_or_sig_reg,
3034 instance_type_args_reg, parent_fun_type_args_reg, delayed_type_args_reg,
3035 &found, &not_found, &next_iteration);
3036 __ Bind(&next_iteration);
3037 __ Comment("Next iteration");
3038 __ AddImmediate(
3039 cache_entry_reg,
3040 target::kCompressedWordSize * target::SubtypeTestCache::kTestEntryLength);
3041 __ Jump(&loop, Assembler::kNearJump);
3042
3043 __ Bind(&found);
3044 __ Comment("Linear found");
3045 gen_found(assembler, n);
3046 __ Bind(&not_found);
3047 __ Comment("Linear not found");
3048 gen_not_found(assembler, n);
3049}

◆ 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 2606 of file stub_code_compiler.cc.

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

◆ 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}

◆ 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}

◆ IntrinsifyArraySetIndexed()

static bool dart::compiler::IntrinsifyArraySetIndexed ( FlowGraph flow_graph,
intptr_t  array_cid 
)
static

Definition at line 218 of file graph_intrinsifier.cc.

219 {
220 GraphEntryInstr* graph_entry = flow_graph->graph_entry();
221 auto normal_entry = graph_entry->normal_entry();
222 BlockBuilder builder(flow_graph, normal_entry, /*with_frame=*/false);
223
224 Definition* array = builder.AddParameter(0);
225 Definition* index = builder.AddParameter(1);
226 Definition* value = builder.AddParameter(2);
227
230
231 index = CreateBoxedParameterIfNeeded(&builder, index, kUnboxedInt64, 1);
232 index = PrepareIndexedOp(flow_graph, &builder, array, index,
233 Slot::GetLengthFieldForArrayCid(array_cid));
234
235 // Value check/conversion.
236 auto const rep = RepresentationUtils::RepresentationOfArrayElement(array_cid);
237 if (IsClampedTypedDataBaseClassId(array_cid)) {
238#if defined(TARGET_ARCH_IS_32_BIT)
239 // On 32-bit architectures, clamping operations need the exact value
240 // for proper operations. On 64-bit architectures, kUnboxedIntPtr
241 // maps to kUnboxedInt64. All other situations get away with
242 // truncating even non-smi values.
243 builder.AddInstruction(
244 new CheckSmiInstr(new Value(value), DeoptId::kNone, builder.Source()));
245#endif
246 }
248 // Use same truncating unbox-instruction for int32 and uint32.
249 auto const unbox_rep = rep == kUnboxedInt32 ? kUnboxedUint32 : rep;
250 value = builder.AddUnboxInstr(unbox_rep, new Value(value),
251 /* is_checked = */ false);
252 } else if (RepresentationUtils::IsUnboxed(rep)) {
253 Zone* zone = flow_graph->zone();
254 Cids* value_check = Cids::CreateMonomorphic(zone, Boxing::BoxCid(rep));
255 builder.AddInstruction(new CheckClassInstr(new Value(value), DeoptId::kNone,
256 *value_check, builder.Source()));
257 value = builder.AddUnboxInstr(rep, new Value(value),
258 /* is_checked = */ true);
259 }
260
261 if (IsExternalTypedDataClassId(array_cid)) {
262 array = builder.AddDefinition(new LoadFieldInstr(
263 new Value(array), Slot::PointerBase_data(),
264 InnerPointerAccess::kCannotBeInnerPointer, builder.Source()));
265 }
266 // No store barrier.
268 IsTypedDataClassId(array_cid));
269 builder.AddInstruction(new StoreIndexedInstr(
270 new Value(array), new Value(index), new Value(value), kNoStoreBarrier,
271 /*index_unboxed=*/false,
272 /*index_scale=*/target::Instance::ElementSizeFor(array_cid), array_cid,
274 // Return null.
275 Definition* null_def = builder.AddNullDefinition();
276 builder.AddReturn(new Value(null_def));
277 return true;
278}
static Definition * CreateBoxedParameterIfNeeded(BlockBuilder *builder, Definition *value, Representation representation, intptr_t arg_index)
static Definition * PrepareIndexedOp(FlowGraph *flow_graph, BlockBuilder *builder, Definition *array, Definition *index, const Slot &length_field)
bool IsTypedDataClassId(intptr_t index)
Definition: class_id.h:433
@ kNoStoreBarrier
Definition: il.h:6301
bool IsClampedTypedDataBaseClassId(intptr_t index)
Definition: class_id.h:461
bool IsExternalTypedDataClassId(intptr_t index)
Definition: class_id.h:447
@ kAlignedAccess
Definition: il.h:6766
static bool IsUnboxedInteger(Representation rep)
Definition: flow_graph.cc:1925

◆ 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()

◆ InvokeTypeCheckFromTypeTestStub()

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

Definition at line 1007 of file stub_code_compiler.cc.

1008 {
1009 __ PushObject(NullObject()); // Make room for result.
1010 __ PushRegistersInOrder({TypeTestABI::kInstanceReg, TypeTestABI::kDstTypeReg,
1011 TypeTestABI::kInstantiatorTypeArgumentsReg,
1012 TypeTestABI::kFunctionTypeArgumentsReg});
1013 __ PushObject(NullObject());
1014 __ PushRegister(TypeTestABI::kSubtypeTestCacheReg);
1015 __ PushImmediate(target::ToRawSmi(mode));
1016 __ CallRuntime(kTypeCheckRuntimeEntry, 7);
1017 __ Drop(1); // mode
1018 __ PopRegister(TypeTestABI::kSubtypeTestCacheReg);
1019 __ Drop(1); // dst_name
1020 __ PopRegister(TypeTestABI::kFunctionTypeArgumentsReg);
1021 __ PopRegister(TypeTestABI::kInstantiatorTypeArgumentsReg);
1022 __ PopRegister(TypeTestABI::kDstTypeReg);
1023 __ PopRegister(TypeTestABI::kInstanceReg);
1024 __ Drop(1); // Discard return value.
1025}
word ToRawSmi(const dart::Object &a)
Definition: runtime_api.cc:960
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:228

◆ IsBoolType()

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

Definition at line 75 of file runtime_api.cc.

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

◆ 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:14783
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:13246

◆ 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:14811

◆ 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)

◆ 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
static constexpr intptr_t kNullIdentityHash
Definition: object.h:10784

◆ 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()

◆ PrepareIndexedOp()

static Definition * dart::compiler::PrepareIndexedOp ( FlowGraph flow_graph,
BlockBuilder builder,
Definition array,
Definition index,
const Slot length_field 
)
static

Definition at line 152 of file graph_intrinsifier.cc.

156 {
157 Definition* length = builder->AddDefinition(
158 new LoadFieldInstr(new Value(array), length_field, InstructionSource()));
159 // Note that the intrinsifier must always use deopting array bound
160 // checks, because intrinsics currently don't support calls.
161 Definition* safe_index = new CheckArrayBoundInstr(
162 new Value(length), new Value(index), DeoptId::kNone);
163 builder->AddDefinition(safe_index);
164 return safe_index;
165}

◆ RepresentationForCid()

static Representation dart::compiler::RepresentationForCid ( intptr_t  cid)
static

Definition at line 131 of file graph_intrinsifier.cc.

131 {
132 switch (cid) {
133 case kDoubleCid:
134 return kUnboxedDouble;
135 case kFloat32x4Cid:
136 return kUnboxedFloat32x4;
137 case kInt32x4Cid:
138 return kUnboxedInt32x4;
139 case kFloat64x2Cid:
140 return kUnboxedFloat64x2;
141 default:
142 UNREACHABLE();
143 return kNoRepresentation;
144 }
145}

◆ 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 1765 of file stub_code_compiler.cc.

1765 {
1767 SuspendState::kSuspendStateVarIndex) *
1769}
intptr_t FrameSlotForVariableIndex(intptr_t index) const
Definition: stack_frame.cc:89

◆ 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:10797

◆ 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:11531

◆ TypedDataMaxNewSpaceElements()

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

Definition at line 255 of file runtime_api.cc.

255 {
258}
word TypedDataElementSizeInBytes(classid_t cid)
Definition: runtime_api.cc:251
static constexpr intptr_t kNewAllocatableSize
Definition: spaces.h:54

◆ VerifyParameterIsBoxed()

static void dart::compiler::VerifyParameterIsBoxed ( BlockBuilder builder,
intptr_t  arg_index 
)
static

Definition at line 167 of file graph_intrinsifier.cc.

167 {
168 const auto& function = builder->function();
169 if (function.is_unboxed_parameter_at(arg_index)) {
170 FATAL("Unsupported unboxed parameter %" Pd " in %s", arg_index,
171 function.ToFullyQualifiedCString());
172 }
173}
#define FATAL(error)
#define Pd
Definition: globals.h:408

◆ 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)
Definition: intrinsifier.cc:88
#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.

◆ 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.

◆ 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.